From patchwork Wed Aug 30 18:27:50 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Zi Yan X-Patchwork-Id: 13370366 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by smtp.lore.kernel.org (Postfix) with ESMTP id 57485C6FA8F for ; Wed, 30 Aug 2023 18:28:19 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 95E5C440165; Wed, 30 Aug 2023 14:28:18 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 90D36440161; Wed, 30 Aug 2023 14:28:18 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 7AEA0440165; Wed, 30 Aug 2023 14:28:18 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0012.hostedemail.com [216.40.44.12]) by kanga.kvack.org (Postfix) with ESMTP id 6509A440161 for ; Wed, 30 Aug 2023 14:28:18 -0400 (EDT) Received: from smtpin03.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay01.hostedemail.com (Postfix) with ESMTP id 3374D1C8FE4 for ; Wed, 30 Aug 2023 18:28:18 +0000 (UTC) X-FDA: 81181605876.03.F246006 Received: from wout5-smtp.messagingengine.com (wout5-smtp.messagingengine.com [64.147.123.21]) by imf14.hostedemail.com (Postfix) with ESMTP id D9E25100039 for ; Wed, 30 Aug 2023 18:28:15 +0000 (UTC) Authentication-Results: imf14.hostedemail.com; dkim=pass header.d=sent.com header.s=fm1 header.b="VzSy6vz/"; dkim=pass header.d=messagingengine.com header.s=fm1 header.b=K0njS7rk; spf=pass (imf14.hostedemail.com: domain of zi.yan@sent.com designates 64.147.123.21 as permitted sender) smtp.mailfrom=zi.yan@sent.com; dmarc=pass (policy=none) header.from=sent.com ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1693420096; h=from:from:sender:reply-to:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-transfer-encoding:content-transfer-encoding: in-reply-to:references:dkim-signature; bh=foDp5yxOH6GyIQ67vpSZpUgHB1689dLzaIy9GEckfQ4=; b=N5n/ye/R6lnHrzPewZutj+k1/Sec3jW9uRFNPBToprtKhWoKWHMTjYOZAHiMjpkS/eKPnW iIxUBbo8CT7RFG6BlGmO7ShlT9qKlXe+VkMlk3YTgeRPZ3XfRhsySBmT/UbLjfDeZqcmqb zIKjByXDhgKyN4A5ox2QjDScYEdbd9I= ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1693420096; a=rsa-sha256; cv=none; b=Ce9zgg5dHESZsYN8T0Fx07E+QY7j84Zad4m1LIIbsIDNqQ4nZZb8FfyK+YaYKw5q93KWXM InWvjvk+Of8T0N3+S01TDjR0Eg0tmoI/I7q0rXavjzdcUPBeJq/7rswU/T7A4sQ9G7dMfh /v59Y6PXHedkX16Q+U3B3pa8GJQgom0= ARC-Authentication-Results: i=1; imf14.hostedemail.com; dkim=pass header.d=sent.com header.s=fm1 header.b="VzSy6vz/"; dkim=pass header.d=messagingengine.com header.s=fm1 header.b=K0njS7rk; spf=pass (imf14.hostedemail.com: domain of zi.yan@sent.com designates 64.147.123.21 as permitted sender) smtp.mailfrom=zi.yan@sent.com; dmarc=pass (policy=none) header.from=sent.com Received: from compute5.internal (compute5.nyi.internal [10.202.2.45]) by mailout.west.internal (Postfix) with ESMTP id C602B3200900; Wed, 30 Aug 2023 14:28:12 -0400 (EDT) Received: from mailfrontend1 ([10.202.2.162]) by compute5.internal (MEProxy); Wed, 30 Aug 2023 14:28:13 -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:message-id:mime-version:reply-to:reply-to:sender :subject:subject:to:to; s=fm1; t=1693420092; x=1693506492; bh=fo Dp5yxOH6GyIQ67vpSZpUgHB1689dLzaIy9GEckfQ4=; b=VzSy6vz/3jEqLcnt9d v70cTqblMSUtCONPDq2FYgH9KbZ6oGQe1ANLeFnEgDOr5gWNNxTw5feWIR4SBX7h +4hFw0pFT8WwNFeFfwmaNrk3PiwuQsrEpmwSlhMR8J48ZSSGJg/XDBrMC5aAADJw 3UcCiWZspWV2Gw7spuWTq1xsaDTlP45JEeacMLmsXm675V2wjdMddi0WEiedGjbD rRizhHE3iwQAUHwImy4bMqWy09AtAfwywDjeXcQgWCkuL1wRGaH42LyhokgusYcn GX2UJ7b4PAjUjtiTTSRhwhNONqdOnww+tHfZkNMiHFpIkuQQWf/OZEtvLKcbDhRj wNGg== 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:message-id:mime-version: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=fm1; t=1693420092; x=1693506492; bh=f oDp5yxOH6GyIQ67vpSZpUgHB1689dLzaIy9GEckfQ4=; b=K0njS7rklou26kRAO Ptbz0hqL7fAXkVMBKaRcwtNpFezNy8PJ+nXQZNAYMMePSYqhe3wUB4DAdktZx0np Q+op8kthM/R+Z40rFmhR1wWiNtDfBJSE6Kd03BmyPjUGZEHtLgZr3mym6CyyUvHK ooGu45R4oxwURaZm632kYTlAejmvAC1A/WVDahOgCKxjFh6jEcS55rEIiU6JeO9n 0nHi7Vp3VYKq3JaVU+YPuU6ewr3rKUuQtEORW9JjBjcuf64KwGzIcVkBpQz/YG6e hJmCewlZS79KxxllqpZAs4ChV+VvXmtDg7FPwb7wb/xIyb30SJ8D8BvHnmSj+p7y 85kqw== X-ME-Sender: X-ME-Received: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgedviedrudefkedguddvjecutefuodetggdotefrod ftvfcurfhrohhfihhlvgemucfhrghsthforghilhdpqfgfvfdpuffrtefokffrpgfnqfgh necuuegrihhlohhuthemuceftddtnecusecvtfgvtghiphhivghnthhsucdlqddutddtmd enogfuohhrthgvugftvggtihhpvdculdegtddmnecujfgurhephffvvefufffkofhrggfg sedtqhertdertddtnecuhfhrohhmpegkihcujggrnhcuoeiiihdrhigrnhesshgvnhhtrd gtohhmqeenucggtffrrghtthgvrhhnpedtgffhtdetledtkeeihfefueeuhedvudfhvdei feevtdektdetgfeiieejuefhtdenucevlhhushhtvghrufhiiigvpedtnecurfgrrhgrmh epmhgrihhlfhhrohhmpeiiihdrhigrnhesshgvnhhtrdgtohhm X-ME-Proxy: Feedback-ID: iccd040f4:Fastmail Received: by mail.messagingengine.com (Postfix) with ESMTPA; Wed, 30 Aug 2023 14:28:11 -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)" Subject: [PATCH 0/3] Use nth_page() in place of direct struct page manipulation Date: Wed, 30 Aug 2023 14:27:50 -0400 Message-Id: <20230830182753.55367-1-zi.yan@sent.com> X-Mailer: git-send-email 2.40.1 Reply-To: Zi Yan MIME-Version: 1.0 X-Stat-Signature: txo4fi7stwf6xih3gec5hqcjqpqnkhti X-Rspamd-Server: rspam10 X-Rspamd-Queue-Id: D9E25100039 X-Rspam-User: X-HE-Tag: 1693420095-509783 X-HE-Meta: U2FsdGVkX19kPCMpZm0Zx94kHzSNcvhRcl3QWKdQjq6lQUZV/1uJSVFtk4v6aY8STeeI0OT7hXeCLZFPBs17PBo/6jxhw+jTAN+qTlWI0Q4rviyy1biY8Vfa/NQiZlHgoBv5KsaPrl5UCy8+GYTcfZsCNqKjRwksEIYuOrMZdhoe6rcwSgJ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O+DJGa3a/B5nYMWGlt9vV//t7G3l9fsQEfhffKBa7jId9xD/mqFFU4Rm1gsmNUxK//qQvAw0ZnVxZ+/9fA3T391W2RJ42l63K4VQLBlAvkIZR4FS2ChjBLZXm1x44SVU8n/UVGsbForOLvMwZHYuTDRMNfKlYIOKBjMS1bXIzPk4hCx1ISz3l89sf+LYER65s6UbFfynNwlagfjqXwE43ftTK5hms= X-Bogosity: Ham, tests=bogofilter, spamicity=0.000000, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: From: Zi Yan On SPARSEMEM without VMEMMAP, struct page is not guaranteed to be contiguous, since each memory section's memmap might be allocated independently. hugetlb pages can go beyond a memory section size, thus direct struct page manipulation on hugetlb pages/subpages might give wrong struct page. Kernel provides nth_page() to do the manipulation properly. Use that whenever code can see hugetlb pages. The patches are on top of next-20230830. Zi Yan (3): mm: use nth_page() in place of direct struct page manipulation. fs: use nth_page() in place of direct struct page manipulation. mips: use nth_page() in place of direct struct page manipulation. arch/mips/mm/cache.c | 2 +- fs/hugetlbfs/inode.c | 4 ++-- mm/cma.c | 2 +- mm/hugetlb.c | 2 +- mm/memory_hotplug.c | 2 +- 5 files changed, 6 insertions(+), 6 deletions(-)