From patchwork Wed Aug 30 18:27:52 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Zi Yan X-Patchwork-Id: 13370368 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 E8C94C83F17 for ; Wed, 30 Aug 2023 18:28:23 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 5DCFD440170; Wed, 30 Aug 2023 14:28:23 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 58BF0440161; Wed, 30 Aug 2023 14:28:23 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 3B8CD440170; Wed, 30 Aug 2023 14:28:23 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0010.hostedemail.com [216.40.44.10]) by kanga.kvack.org (Postfix) with ESMTP id 26646440161 for ; Wed, 30 Aug 2023 14:28:23 -0400 (EDT) Received: from smtpin21.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay03.hostedemail.com (Postfix) with ESMTP id ED51AA0364 for ; Wed, 30 Aug 2023 18:28:22 +0000 (UTC) X-FDA: 81181606044.21.1D5BFCB Received: from wout5-smtp.messagingengine.com (wout5-smtp.messagingengine.com [64.147.123.21]) by imf10.hostedemail.com (Postfix) with ESMTP id 9AFD0C0008 for ; Wed, 30 Aug 2023 18:28:20 +0000 (UTC) Authentication-Results: imf10.hostedemail.com; dkim=pass header.d=sent.com header.s=fm1 header.b=wVMie9Qf; dkim=pass header.d=messagingengine.com header.s=fm1 header.b=ziKY7X6d; spf=pass (imf10.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=1693420100; 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:in-reply-to:references:references:dkim-signature; bh=TK10HtZMWkaeyr29jSGk50ed2+QFV4733ljLHyyzZmA=; b=zbYZskQ1kPiENvN9w9kvm5Oew2vNUJI1ecsstcOp38E6DajNDjwWWKqqvciHkyj8y9SeVL s83HhWzU9r5TwUg3G9EALQFr0Jr7JGbCc8bqWczvp0jEcba+6EOARhEVNOJZ3g4x87DMh6 AhqEpBARRov/Y/XgAaun7ZvLs6HJIqM= ARC-Authentication-Results: i=1; imf10.hostedemail.com; dkim=pass header.d=sent.com header.s=fm1 header.b=wVMie9Qf; dkim=pass header.d=messagingengine.com header.s=fm1 header.b=ziKY7X6d; spf=pass (imf10.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-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1693420100; a=rsa-sha256; cv=none; b=zV1w8Dv4qr5CNVN2Jerj/NntTAoXzg7kgA0TJSonCpK8UhK8XvLtt5WFghYMqDDVZ9Oplg 1FOU9WAe0PAkj2u7gnKDGLclMCO4R2l9gymsyWD4qX8JnkTxfSqKQIocz3xauHwUdSHJQQ k5WUZIrCEl5xWQqVeU7v2lE5cKdhWsk= Received: from compute1.internal (compute1.nyi.internal [10.202.2.41]) by mailout.west.internal (Postfix) with ESMTP id F3E6B3200941; Wed, 30 Aug 2023 14:28:17 -0400 (EDT) Received: from mailfrontend1 ([10.202.2.162]) by compute1.internal (MEProxy); Wed, 30 Aug 2023 14:28:19 -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=fm1; t= 1693420097; x=1693506497; bh=TK10HtZMWkaeyr29jSGk50ed2+QFV4733lj LHyyzZmA=; b=wVMie9QfMJAfZCtvv/CLDGpDzW3bh1Gk2NBoHI0hoWVREkq3dgY +48nO3GAyn8XC8bHDHwCMgtHeYijkz4DyOvLKjhu5deoObYlNMb0goJJjbZPsuSH Cv7QNhvzmMVF2GY3Ww2fGD756MsZeGZyt4qWPrS3k4peKFRXBklabFvKqkEzEkfo 65LebOhjDZ0OjDqI+IEjtYVPRVxlNBWX3PvW79tpEsPO7LmlzMplzFuvc4lEXItR JybkxgkU+tSm8bLdjGkGvLQwvl4WA39HGvA25kn8MF5WXW3C6gnj5OwbFHEXvrYa +OghkryonUAqHfmrb85aB3C6QdtiBxWzK/g== 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=fm1; t= 1693420097; x=1693506497; bh=TK10HtZMWkaeyr29jSGk50ed2+QFV4733lj LHyyzZmA=; b=ziKY7X6dy6aRNNRouY0tNqlLuvndGRS+knN/IbPMk7xsieoO0V9 t6GT+lSpAx7hVmg7VucGt/Mf8iWiYr7Zdmf2FyWYpnsdARUqCpaBz9kkgIODylZb wqGxcXVnoqmfusEjtA52SiWcxEbwNmo+oDq/xRfEW8fabKcf/ZkcbddJZmvfI3w+ G92FFGG49+NslDWY2fNtHQUWvbdA1euJRCL1IEBizJ9G10crBI0P0l3yPJiXa+xs BIJuSuh/hZoDcqS4cPssInZIixidGnVxs3HLgfvtXqpTRFDyMwAbORQCMs63yYDb tztU+jJdL6QM8YZSiM2ZSY1hiJ5RAPf2NWw== X-ME-Sender: X-ME-Received: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgedviedrudefkedguddvjecutefuodetggdotefrod ftvfcurfhrohhfihhlvgemucfhrghsthforghilhdpqfgfvfdpuffrtefokffrpgfnqfgh necuuegrihhlohhuthemuceftddtnecusecvtfgvtghiphhivghnthhsucdlqddutddtmd enogfuohhrthgvugftvggtihhpvdculdegtddmnecujfgurhephffvvefufffkofgjfhhr ggfgsedtqhertdertddtnecuhfhrohhmpegkihcujggrnhcuoeiiihdrhigrnhesshgvnh htrdgtohhmqeenucggtffrrghtthgvrhhnpeeggeehudfgudduvdelheehteegledtteei veeuhfffveekhfevueefieeijeegvdenucevlhhushhtvghrufhiiigvpedtnecurfgrrh grmhepmhgrihhlfhhrohhmpeiiihdrhigrnhesshgvnhhtrdgtohhm X-ME-Proxy: Feedback-ID: iccd040f4:Fastmail Received: by mail.messagingengine.com (Postfix) with ESMTPA; Wed, 30 Aug 2023 14:28:16 -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 2/3] fs: use nth_page() in place of direct struct page manipulation. Date: Wed, 30 Aug 2023 14:27:52 -0400 Message-Id: <20230830182753.55367-3-zi.yan@sent.com> X-Mailer: git-send-email 2.40.1 In-Reply-To: <20230830182753.55367-1-zi.yan@sent.com> References: <20230830182753.55367-1-zi.yan@sent.com> Reply-To: Zi Yan MIME-Version: 1.0 X-Rspamd-Queue-Id: 9AFD0C0008 X-Rspam-User: X-Stat-Signature: b5s1dyn9yd5ceayydz1inigk9g3qmc8w X-Rspamd-Server: rspam01 X-HE-Tag: 1693420100-243824 X-HE-Meta: U2FsdGVkX1//rOBFPfjqYMHZlHQyt8+U/bd6+jfvkhpvOoJQ6NiquOrpGXBqAlxU0RdiLT7eq9nGVt3mybTiPWHoQh9icst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aEe0Vu6zEezQd1IbzGnjlNU9qZCz7lk0o0Z8sQjCkOJUn/f1ZK94N4JLCkBuJDLmnXsReoEEqiPm3f2A/WNXPZ3cm4QiroCfky+9vLWAi2uvmpei83zps1FtVIg36pHCeY4yC/uaiCmO0EzCUahFiiyPTyZDOJ89WrT53YRzmJFA4F4lDWzsbk+PkupA7LtSUCdEQFo+KZnHAlrqCvxTJUJNKNyP337CMifMpd4jbO+RXIP6FdgqmwjdJW2Sf8J+stkrlarc0Gqb/8WwVWuwhWGLkFDC3OEzqcZw+AdUm0kTzA/I1Q8Rg= 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 When dealing with hugetlb pages, struct page is not guaranteed to be contiguous on SPARSEMEM without VMEMMAP. Use nth_page() to handle it properly. Signed-off-by: Zi Yan Reviewed-by: Muchun Song --- fs/hugetlbfs/inode.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/fs/hugetlbfs/inode.c b/fs/hugetlbfs/inode.c index 316c4cebd3f3..60fce26ff937 100644 --- a/fs/hugetlbfs/inode.c +++ b/fs/hugetlbfs/inode.c @@ -295,7 +295,7 @@ static size_t adjust_range_hwpoison(struct page *page, size_t offset, size_t byt size_t res = 0; /* First subpage to start the loop. */ - page += offset / PAGE_SIZE; + page = nth_page(page, offset / PAGE_SIZE); offset %= PAGE_SIZE; while (1) { if (is_raw_hwpoison_page_in_hugepage(page)) @@ -309,7 +309,7 @@ static size_t adjust_range_hwpoison(struct page *page, size_t offset, size_t byt break; offset += n; if (offset == PAGE_SIZE) { - page++; + page = nth_page(page, 1); offset = 0; } }