From patchwork Wed Aug 30 18:27:53 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Zi Yan X-Patchwork-Id: 13370369 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 6B06CC6FA8F for ; Wed, 30 Aug 2023 18:28:26 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id BF5D3440171; Wed, 30 Aug 2023 14:28:25 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id B7E62440161; Wed, 30 Aug 2023 14:28:25 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 9D11C440171; Wed, 30 Aug 2023 14:28:25 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0014.hostedemail.com [216.40.44.14]) by kanga.kvack.org (Postfix) with ESMTP id 8B575440161 for ; Wed, 30 Aug 2023 14:28:25 -0400 (EDT) Received: from smtpin26.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay05.hostedemail.com (Postfix) with ESMTP id 5DF2040334 for ; Wed, 30 Aug 2023 18:28:25 +0000 (UTC) X-FDA: 81181606170.26.E8C8576 Received: from wout5-smtp.messagingengine.com (wout5-smtp.messagingengine.com [64.147.123.21]) by imf26.hostedemail.com (Postfix) with ESMTP id 1FA52140022 for ; Wed, 30 Aug 2023 18:28:22 +0000 (UTC) Authentication-Results: imf26.hostedemail.com; dkim=pass header.d=sent.com header.s=fm1 header.b=EYBx63Ev; dkim=pass header.d=messagingengine.com header.s=fm1 header.b=cIqp7Ocq; dmarc=pass (policy=none) header.from=sent.com; spf=pass (imf26.hostedemail.com: domain of zi.yan@sent.com designates 64.147.123.21 as permitted sender) smtp.mailfrom=zi.yan@sent.com ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1693420103; 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=UaWYMjZoz/qbv6HU3P8JXTg44k1buzeqH5W8mgla10I=; b=XRrtXQO6MjDwiNrznNluL4Ib1ypI4aXgVcDQtwl4bR9pWmAzRyWyXNKwGL2hu010l88U0A Cl+N6AfoUti5MfpB45JDe1g+VTW1ZhiW/JH4T2TPwY3/VBGJD5RfNxRN32meQRUmUIiI5C k5R280N4cpF+F7kdOF8Pj32yOToAiXo= ARC-Authentication-Results: i=1; imf26.hostedemail.com; dkim=pass header.d=sent.com header.s=fm1 header.b=EYBx63Ev; dkim=pass header.d=messagingengine.com header.s=fm1 header.b=cIqp7Ocq; dmarc=pass (policy=none) header.from=sent.com; spf=pass (imf26.hostedemail.com: domain of zi.yan@sent.com designates 64.147.123.21 as permitted sender) smtp.mailfrom=zi.yan@sent.com ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1693420103; a=rsa-sha256; cv=none; b=Lqcg9+CJUyRtCFr1fU8MaWYZZt9EEP79brQNgN/9qmJ3kl+8c2ncn0NzLb8nrTrNm4e0S/ 2xa0nGnTFVXiKIA738UkwmI9sdufTcUtzUXzlU3vPQJg28BUcP1pxZtStl7kfzl8VGLuuS 32Fd1KtNqwUbW8qcRWQP/zRVi6D2jGM= Received: from compute5.internal (compute5.nyi.internal [10.202.2.45]) by mailout.west.internal (Postfix) with ESMTP id 70DC23200942; Wed, 30 Aug 2023 14:28:20 -0400 (EDT) Received: from mailfrontend1 ([10.202.2.162]) by compute5.internal (MEProxy); Wed, 30 Aug 2023 14:28:21 -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= 1693420099; x=1693506499; bh=UaWYMjZoz/qbv6HU3P8JXTg44k1buzeqH5W 8mgla10I=; b=EYBx63EvFZjpL4B27TvMy7dGqT0pwxAoSEQMIg8pIUrC14oW5Qe NQQkav+XRQAccBSjDYtL6wGLdshSlcg1rzwDN10arpEUSJWVjaH6IgApWfE4wz2k NJrHO5LIciwfDdoPDOe6ZjYQxyAx+9Qp/yhg90D1Mu/zDRHBh+usGjHa8kak61BH +wRtghRwUfwcK5/g4dAMCzoN5W7fRgb6/Fc0s9E42Y4N6bQRYuO/UkeirPUMSiZp yZ2IN3lwvHgVsMMyVUZL8ujlFJZVEXlmSYvbJK3v4JmwYHq8eQAgRitNdVAr72K/ 83+G2VVVKYJBkgGYIUdzl6PFgre20wJhuxw== 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= 1693420099; x=1693506499; bh=UaWYMjZoz/qbv6HU3P8JXTg44k1buzeqH5W 8mgla10I=; b=cIqp7OcqR9mAO5om8208dHU0wNnEriPSq/ag/Nx4a6D5SqamN6H u5pPrVI3kn3E2aS0lJco43LEkbh81xEEzrwAjk1UPuFe/Q1Gu0D3lR1Jd20Zu1Mb gdjd18scjP00w/1McZqpwobB31v+bdGi+n1BVFMzoHn//F67+rVg9YaYsXDC1vi1 b49vnbHA72x2FuM7RHMCZpxiG9NycXuTOEiki0emG1ppfM0lGJf6JXWoJSRt9xrv eX/aAvXfHx1aQbS9TyPhFAOhk0jRQP0Bm66uUGmD/P3FdC5dkgxYpXaV/oKOBN+Y D5N/biYochIaLDXNgUc6e45rtgmFJlOkXGw== 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:19 -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 3/3] mips: use nth_page() in place of direct struct page manipulation. Date: Wed, 30 Aug 2023 14:27:53 -0400 Message-Id: <20230830182753.55367-4-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-Rspam-User: X-Rspamd-Server: rspam12 X-Rspamd-Queue-Id: 1FA52140022 X-Stat-Signature: xuqt1urobi9nob96c63nkayteogtood8 X-HE-Tag: 1693420102-478604 X-HE-Meta: U2FsdGVkX19XXpRHb8VE9QYEPEhR7mbbwBHS2tM+swNzZYhUyrUKfKH07kDxKAYgwL1rqVrQ3/DFDrscXgPggR4H5XReq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sA5bR1qLn2rOLEKDIIr3UE7MZvaTrtDb+zLLZ9DJZZAEnC5Y9KPaKscRxmr3jayA7w64hv6ud+or565Mz7uW6167Fru7+4/M8SCPKm6jBEVxZUHR0UzKMVaieqe9klaTQOUFJwqFmkVBb6uo6A6mPT/vwdN2CNFrDiHQV3rCCdtwCKTHLL0QLAS46RObA3uLm67e1SGyKA1pLAMIqsYgiTHhG6nGkyNsIHF2FlpQIZi+fLjVQJ2fqToBVOOaHjY600zmf5hcShHSax0tdT/5iXAPwOEk1WziPofEGbJKLTbSv2iXsbk= 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 __flush_dcache_pages() is called during hugetlb migration via migrate_pages() -> migrate_hugetlbs() -> unmap_and_move_huge_page() -> move_to_new_folio() -> flush_dcache_folio(). And with hugetlb and without sparsemem vmemmap, struct page is not guaranteed to be contiguous beyond a section. Use nth_page() instead. Signed-off-by: Zi Yan --- arch/mips/mm/cache.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/arch/mips/mm/cache.c b/arch/mips/mm/cache.c index 02042100e267..7f830634dbe7 100644 --- a/arch/mips/mm/cache.c +++ b/arch/mips/mm/cache.c @@ -117,7 +117,7 @@ void __flush_dcache_pages(struct page *page, unsigned int nr) * get faulted into the tlb (and thus flushed) anyways. */ for (i = 0; i < nr; i++) { - addr = (unsigned long)kmap_local_page(page + i); + addr = (unsigned long)kmap_local_page(nth_page(page, i)); flush_data_cache_page(addr); kunmap_local((void *)addr); }