From patchwork Wed Sep 13 20:12:43 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Zi Yan X-Patchwork-Id: 13958 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:612c:172:b0:3f2:4152:657d with SMTP id h50csp72706vqi; Wed, 13 Sep 2023 19:54:47 -0700 (PDT) X-Google-Smtp-Source: AGHT+IFs2zaBCsqo57+pT/cBip2kHzqDsWJw8jTxYTnxhcfG8b1+wKjF+hyfBCOl/PRA3Iak+sAO X-Received: by 2002:a05:6a00:17a6:b0:68c:3f2:6007 with SMTP id s38-20020a056a0017a600b0068c03f26007mr5737001pfg.8.1694660087133; Wed, 13 Sep 2023 19:54:47 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1694660087; cv=none; d=google.com; s=arc-20160816; b=f1dSrB+zGzy1ix2ohll6aY9RgM05L6RqWwZdzUwB/ZStfb76TWieD+lxzoqR5wmXx5 UM7GL1UknJbFvq/s5HnvwG4O5k0JtPXHm7HaIh3QoKKICwzkpdXCnM7YyzfbiAHJZ9HZ Ug73N9JQH3cyIws+nNg4VA1ZylYpuhnJs667t2T/kkx0WeKcW2VfpJrPuaiE9rQA/ooP s51uCHeMrhG3KCT11ukpBA7Xz3xZ+DKd1HJkbiJZLr8Sa9i8i6OPpdEshRBsOpnnBksc IVT9d7o7YcVEMWCd0/wKWJRnRkEEVyHVUJ1xsBaQamgTwLgc/PwnddYTP7WAjGJAhq+T /h4g== 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 :message-id:date:subject:cc:to:from:feedback-id:dkim-signature :dkim-signature; bh=nWGq1gLR7F41muaJaoLOMct76xa7LgE2SjtA7mYmrLE=; fh=XpYMXypAv+jFhN7PPgOSToX5TXPCy6dt7dSe0qQ1mng=; b=bqWbLBmlshqVt7CCDW7HBmAWU1k6rNabPHCZL5bfkEo3hISoyZBGd5nj1c6FrKp2Mk 6eWZS5MsaunRfl7u6mH+nXvFGYICv/bxFF9oedSxf2rdvQ5KJZ6A9ueHM00S+FLZpwvq hQ3qCkvUZ5mJwrQX8v7YwFJPJZnortHoUZdVBsU0w7tIPCEp7RC1tqGUW5HNoeaGY0EF jYaIJj5QoIMtekfWKoKYMSvKof35NGArnN2BpaueaXZ6IoWSqHWx1aGDydgL5s7UGDNB 9r7GME5cPTdowvoVDeo3X+vw5yk/OTrH8SzP0zExXxwcF/edtObkcAqYBKOtBn9lN1k/ /Z3A== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@sent.com header.s=fm2 header.b=xvbgZdE3; dkim=pass header.i=@messagingengine.com header.s=fm2 header.b=q9t1HOCl; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:4 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 howler.vger.email (howler.vger.email. [2620:137:e000::3:4]) by mx.google.com with ESMTPS id bu4-20020a056a00410400b0069024c6a9a8si584341pfb.389.2023.09.13.19.54.46 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 13 Sep 2023 19:54:47 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:4 as permitted sender) client-ip=2620:137:e000::3:4; Authentication-Results: mx.google.com; dkim=pass header.i=@sent.com header.s=fm2 header.b=xvbgZdE3; dkim=pass header.i=@messagingengine.com header.s=fm2 header.b=q9t1HOCl; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:4 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 howler.vger.email (Postfix) with ESMTP id AA749804911C; Wed, 13 Sep 2023 13:13:19 -0700 (PDT) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.10 at howler.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232101AbjIMUNR (ORCPT + 34 others); Wed, 13 Sep 2023 16:13:17 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:33904 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231603AbjIMUNQ (ORCPT ); Wed, 13 Sep 2023 16:13:16 -0400 Received: from wout3-smtp.messagingengine.com (wout3-smtp.messagingengine.com [64.147.123.19]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 01F331BC3; Wed, 13 Sep 2023 13:13:12 -0700 (PDT) Received: from compute3.internal (compute3.nyi.internal [10.202.2.43]) by mailout.west.internal (Postfix) with ESMTP id 3AD4C3200931; Wed, 13 Sep 2023 16:13:11 -0400 (EDT) Received: from mailfrontend2 ([10.202.2.163]) by compute3.internal (MEProxy); Wed, 13 Sep 2023 16:13:12 -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=fm2; t=1694635990; x=1694722390; bh=nW Gq1gLR7F41muaJaoLOMct76xa7LgE2SjtA7mYmrLE=; b=xvbgZdE3/nGTuYUUvH u5cCgINz/3pwJhWTguTgefNOzbUhpNqf3mZHxc4jf8Gi1EVIya1H3GR2ZBgF/dXp 7hNXBAXnSlbfx4HBobFsvvCCxiPdcnXymIZOsu41aom5nBhu4l7FXoH8I5VF0SnJ U68NDJ6hCCK5D67ktwRZBjTvJTpdc2KhnOPUvPQyG8kZIysketKrIAR6AZfd5HmF 85F0KpKO2XbB71FviIWMfeskmsu7YynqqsOHNaBB/JJbZYM38i6zff7PpOD4Kscf TWLBWUYJik0rQBafXPQJ/RTOd+g2sPesJscNbLDHt04KAWgTzv0XMC8C83F7Sret mJ1A== 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=fm2; t=1694635990; x=1694722390; bh=n WGq1gLR7F41muaJaoLOMct76xa7LgE2SjtA7mYmrLE=; b=q9t1HOCltCbs9NGp2 35SQHUh7Yz5SCWu97v/ldfktBV9gKyWzHfSBHsZcxXGXkk/Dbz3Yr/6sPJY+YWj+ Bc5gJ/GC57NUV4TOAR9Y+nqkp0XcRZK5QSyxjGVmPWLNldWyLWOd/DnqdtqTxxmt gMtqtLzXzKIOGCOWdTIg/epr7yg8lYox9+bsRr2ibP+Q2wFCLzUOe2NTW9x3fVgc TzqjN5HUq7VwAeGfjUdXL1EI4tVzsEDBgSAQBz4HZtMb7l7+gOHHugHK+fG9rneN XIcAVxVDCw3nkHNGILSx5VEblUtX8o/6wecDsvsW794pGIMpChkMXrjpIsKjRohQ MECQA== X-ME-Sender: X-ME-Received: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgedviedrudeikedgudegiecutefuodetggdotefrod ftvfcurfhrohhfihhlvgemucfhrghsthforghilhdpqfgfvfdpuffrtefokffrpgfnqfgh necuuegrihhlohhuthemuceftddtnecusecvtfgvtghiphhivghnthhsucdlqddutddtmd enogfuohhrthgvugftvggtihhpvdculdegtddmnecujfgurhephffvvefufffkofhrggfg sedtqhertdertddtnecuhfhrohhmpegkihcujggrnhcuoeiiihdrhigrnhesshgvnhhtrd gtohhmqeenucggtffrrghtthgvrhhnpeduffekueejvdetgeelgfdvudfggfejtedvheev hedvhedvjedvgeejvdffleeuveenucffohhmrghinhepmhgrnhhiphhulhgrthhiohhnrd hmmhenucevlhhushhtvghrufhiiigvpedtnecurfgrrhgrmhepmhgrihhlfhhrohhmpeii ihdrhigrnhesshgvnhhtrdgtohhm X-ME-Proxy: Feedback-ID: iccd040f4:Fastmail Received: by mail.messagingengine.com (Postfix) with ESMTPA; Wed, 13 Sep 2023 16:13:09 -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 v3 0/5] Use nth_page() in place of direct struct page manipulation Date: Wed, 13 Sep 2023 16:12:43 -0400 Message-Id: <20230913201248.452081-1-zi.yan@sent.com> X-Mailer: git-send-email 2.40.1 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 (howler.vger.email [0.0.0.0]); Wed, 13 Sep 2023 13:13:19 -0700 (PDT) X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1776977399817494439 X-GMAIL-MSGID: 1776979895191059748 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-20230913 Changes: From v2: 1. Fixed the subject and the commit log of Patch 3 (David Hildenbrand) From v1: 1. Separated first patch into three and add Fixes for better backport. Zi Yan (5): mm/cma: use nth_page() in place of direct struct page manipulation. mm/hugetlb: use nth_page() in place of direct struct page manipulation. mm/memory_hotplug: use pfn math 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(-)