From patchwork Wed Sep 13 20:12:44 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Zi Yan X-Patchwork-Id: 139165 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:6358:a5a:b0:13f:353d:d1ed with SMTP id 26csp83551rwb; Wed, 13 Sep 2023 16:47:35 -0700 (PDT) X-Google-Smtp-Source: AGHT+IEMWtt053nQy0KXhZut0K5Z2cy2wpK304au93fviH71mcjCpPPE/4fROdJjh2L2VYXHhp/u X-Received: by 2002:a17:903:264a:b0:1c0:93b6:2e4b with SMTP id je10-20020a170903264a00b001c093b62e4bmr3780251plb.33.1694648854642; Wed, 13 Sep 2023 16:47:34 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1694648854; cv=none; d=google.com; s=arc-20160816; b=KA2M3uj8keSsORW/g3de4bXw6WREQjoPJR3vnRSl5BOKtTES/rEaElTROyYyhziKcW sIf3p1RQPdqA81Roa5Tx7CXfIMBFSoJW8sNKLLgeAE5HqVBKILZowbn10vf2FXO5QRlp ooCLUqdTYf4Wqx6qEV6hVBTMRV4VNcN5Ygn4J55btJWmWfkELIR/3L2P+7kEnVmZKqAK 8PwzGnsYQjhjpHF3iq586A3nWWL5xP4cxVVxGSmgAggGH2y8b/q2EXE884p76q33sqfA zmCYt+XYqQFSjyfW8c0TUWjBQwvToB9u0Pk8u0Tb/1n6f1PH916mLrjwEy8XhccbLYPB lhJQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version:reply-to :references:in-reply-to:message-id:date:subject:cc:to:from :feedback-id:dkim-signature:dkim-signature; bh=W7emFMpfIMC3wLaZ+9JtBDyJqJ6ODUK3zLRX50gZBXo=; fh=uXOOnG6dSiAFwWm6vSsvJiwW7q8GOjY1G0eNovT28gQ=; b=YT0ckjVdGpfuiFCuEltb1igY4qRaihhOASWboZQL6+1QAvQhT6vslB3wskpiHEklDR iq+vhHWO5XmrQoxeS3hjCLlp6D9zU1w4ryjTQGy+cJJO9nG1PX5nF2JAvSgj9+eizmh6 0ix1jPJ9RnR9003Ubf7SeXYmT/xkxQMeYTciIF82fZrGpv0xee+jytIA3jrOveYEMVmc 0iTvJneayk5R+R0F7k+NuvGPhpHhMAme4AUH567eyhyALDK1avNuwMP0XBaCPKaRsj5f C0HMGfltmO4fALdcYkMYNkuIEUxjyj3e1xqfrjWbzmSDhx9QvkXhykk0+nf4b3PJII2L nw3g== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@sent.com header.s=fm2 header.b=sQpceFCL; dkim=pass header.i=@messagingengine.com header.s=fm2 header.b=f1J1usMY; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.32 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=sent.com Received: from agentk.vger.email (agentk.vger.email. [23.128.96.32]) by mx.google.com with ESMTPS id a15-20020a170902eccf00b001bf01fee6bcsi372765plh.610.2023.09.13.16.47.33 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 13 Sep 2023 16:47:34 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.32 as permitted sender) client-ip=23.128.96.32; Authentication-Results: mx.google.com; dkim=pass header.i=@sent.com header.s=fm2 header.b=sQpceFCL; dkim=pass header.i=@messagingengine.com header.s=fm2 header.b=f1J1usMY; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.32 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=sent.com Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by agentk.vger.email (Postfix) with ESMTP id DB59181F8500; Wed, 13 Sep 2023 13:13:41 -0700 (PDT) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.10 at agentk.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232165AbjIMUNW (ORCPT + 34 others); Wed, 13 Sep 2023 16:13:22 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:33912 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232128AbjIMUNT (ORCPT ); Wed, 13 Sep 2023 16:13:19 -0400 Received: from wout3-smtp.messagingengine.com (wout3-smtp.messagingengine.com [64.147.123.19]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 9E28B1BC3; Wed, 13 Sep 2023 13:13:15 -0700 (PDT) Received: from compute4.internal (compute4.nyi.internal [10.202.2.44]) by mailout.west.internal (Postfix) with ESMTP id EC566320097B; Wed, 13 Sep 2023 16:13:13 -0400 (EDT) Received: from mailfrontend2 ([10.202.2.163]) by compute4.internal (MEProxy); Wed, 13 Sep 2023 16:13:15 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sent.com; h=cc :cc:content-transfer-encoding:content-type:date:date:from:from :in-reply-to:in-reply-to:message-id:mime-version:references :reply-to:reply-to:sender:subject:subject:to:to; s=fm2; t= 1694635993; x=1694722393; bh=W7emFMpfIMC3wLaZ+9JtBDyJqJ6ODUK3zLR X50gZBXo=; b=sQpceFCLA909BuTBZz+XL7Q94NZUOHGGjEudXMqrizGzLm9Mb35 QM+B7t8k3bGRHWOpM/I482LZgSftZIcr83fv6RxhAbx9PYx7xrpH9GBYEcHV8pAY 092W5LzEHe5FlGT9COx/ZIMaak1lx5dG4Hy3cSU00rZ21EUlzJ1TS8V7t8oNwEd9 TGzQ2QwH816D/VZjV51qnHMOAo22MmKiPSyltaa9W7YrRoID0uyOz27pGvX6ScmW PhCfwmjfx7T5kl9ANLy520k73m101Dbjvf2e4pUcgL1RUK6Magi2AMGuKnhZ93WD +KMSNhzFvGhVh/inlQ0KSLF9hLelEjS5gdw== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:cc:content-transfer-encoding :content-type:date:date:feedback-id:feedback-id:from:from :in-reply-to:in-reply-to:message-id:mime-version:references :reply-to:reply-to:sender:subject:subject:to:to:x-me-proxy :x-me-proxy:x-me-sender:x-me-sender:x-sasl-enc; s=fm2; t= 1694635993; x=1694722393; bh=W7emFMpfIMC3wLaZ+9JtBDyJqJ6ODUK3zLR X50gZBXo=; b=f1J1usMYiSOuxL63bAr+b2r34zPIFYmvIMyOXr6CZeN2rm009Kf FFNbRaH5Zx7NXkXq4ElkCtNaRarPsMZHXaDe1qU6YTMkKuYG1qu49BqwYdiRdC86 8bPr3ikD2rS7M4sEajJfpBPmUwRVZOYV5EsZWY0cLSPUMm1W/LSqWbcHFl5y6fsY v+7MbXPcmDhVQQtKIrAX8ivkvC6fWEKOBTRvP3GAtI3jarH2FVTlPsvgGKeXQXvz DPEl4UDmWoBKthefGJm40hI1C76wHMX8xPVldQHBqILyAP6g/IpHBeMOvWSkAC6K 12Rp/ZsWNw8NW3aG5+v22TqG0QbmheKzZ4g== X-ME-Sender: X-ME-Received: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgedviedrudeikedgudegiecutefuodetggdotefrod ftvfcurfhrohhfihhlvgemucfhrghsthforghilhdpqfgfvfdpuffrtefokffrpgfnqfgh necuuegrihhlohhuthemuceftddtnecusecvtfgvtghiphhivghnthhsucdlqddutddtmd enogfuohhrthgvugftvggtihhpvdculdegtddmnecujfgurhephffvvefufffkofgjfhhr ggfgsedtqhertdertddtnecuhfhrohhmpegkihcujggrnhcuoeiiihdrhigrnhesshgvnh htrdgtohhmqeenucggtffrrghtthgvrhhnpeeggeehudfgudduvdelheehteegledtteei veeuhfffveekhfevueefieeijeegvdenucevlhhushhtvghrufhiiigvpedtnecurfgrrh grmhepmhgrihhlfhhrohhmpeiiihdrhigrnhesshgvnhhtrdgtohhm X-ME-Proxy: Feedback-ID: iccd040f4:Fastmail Received: by mail.messagingengine.com (Postfix) with ESMTPA; Wed, 13 Sep 2023 16:13:12 -0400 (EDT) From: Zi Yan To: linux-mm@kvack.org, linux-kernel@vger.kernel.org, linux-mips@vger.kernel.org Cc: Zi Yan , Andrew Morton , Thomas Bogendoerfer , "Matthew Wilcox (Oracle)" , David Hildenbrand , Mike Kravetz , Muchun Song , "Mike Rapoport (IBM)" , stable@vger.kernel.org, Muchun Song Subject: [PATCH v3 1/5] mm/cma: use nth_page() in place of direct struct page manipulation. Date: Wed, 13 Sep 2023 16:12:44 -0400 Message-Id: <20230913201248.452081-2-zi.yan@sent.com> X-Mailer: git-send-email 2.40.1 In-Reply-To: <20230913201248.452081-1-zi.yan@sent.com> References: <20230913201248.452081-1-zi.yan@sent.com> Reply-To: Zi Yan MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (agentk.vger.email [0.0.0.0]); Wed, 13 Sep 2023 13:13:41 -0700 (PDT) X-Spam-Status: No, score=-0.6 required=5.0 tests=DKIM_SIGNED,DKIM_VALID, DKIM_VALID_AU,FREEMAIL_FORGED_FROMDOMAIN,FREEMAIL_FROM, HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,SPF_HELO_NONE, SPF_PASS autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on agentk.vger.email X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1776968117749431546 X-GMAIL-MSGID: 1776968117749431546 From: Zi Yan When dealing with hugetlb pages, manipulating struct page pointers directly can get to wrong struct page, since struct page is not guaranteed to be contiguous on SPARSEMEM without VMEMMAP. Use nth_page() to handle it properly. Fixes: 2813b9c02962 ("kasan, mm, arm64: tag non slab memory allocated via pagealloc") Cc: Signed-off-by: Zi Yan Reviewed-by: Muchun Song --- mm/cma.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/mm/cma.c b/mm/cma.c index da2967c6a223..2b2494fd6b59 100644 --- a/mm/cma.c +++ b/mm/cma.c @@ -505,7 +505,7 @@ struct page *cma_alloc(struct cma *cma, unsigned long count, */ if (page) { for (i = 0; i < count; i++) - page_kasan_tag_reset(page + i); + page_kasan_tag_reset(nth_page(page, i)); } if (ret && !no_warn) {