From patchwork Wed Sep 13 20:12:48 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Zi Yan X-Patchwork-Id: 13383749 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 04C43EE020C for ; Wed, 13 Sep 2023 20:13:29 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id CA18F6B028F; Wed, 13 Sep 2023 16:13:28 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id C52516B0290; Wed, 13 Sep 2023 16:13:28 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id AF1686B0291; Wed, 13 Sep 2023 16:13:28 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0013.hostedemail.com [216.40.44.13]) by kanga.kvack.org (Postfix) with ESMTP id 9FCD36B028F for ; Wed, 13 Sep 2023 16:13:28 -0400 (EDT) Received: from smtpin15.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay02.hostedemail.com (Postfix) with ESMTP id 8069812056A for ; Wed, 13 Sep 2023 20:13:28 +0000 (UTC) X-FDA: 81232674096.15.1C955FC Received: from wout3-smtp.messagingengine.com (wout3-smtp.messagingengine.com [64.147.123.19]) by imf08.hostedemail.com (Postfix) with ESMTP id 4C4E2160018 for ; Wed, 13 Sep 2023 20:13:26 +0000 (UTC) Authentication-Results: imf08.hostedemail.com; dkim=pass header.d=sent.com header.s=fm2 header.b=CBOmFlmf; dkim=pass header.d=messagingengine.com header.s=fm2 header.b=R04EHa4q; dmarc=pass (policy=none) header.from=sent.com; spf=pass (imf08.hostedemail.com: domain of zi.yan@sent.com designates 64.147.123.19 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=1694636006; 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=X7/kZB7lpmBCw2k1unMB2GujXf55nXH6oT8ByqeAnAs=; b=NbXNEebFL6ZGNoRzVuj1IGPSxNbtTlq6iAcgMZhEj8vF15KZTdee2h3IP1GptNi5ntuMJQ E4YSILDExSIxp1ndrUJelF7XSa2w2akvtYOWv0p7GhlfZ66pDWhu4roacHxoDRqJWV5JEA UmFoY407X+JRpxIZ117iuOKVInpqIz8= ARC-Authentication-Results: i=1; imf08.hostedemail.com; dkim=pass header.d=sent.com header.s=fm2 header.b=CBOmFlmf; dkim=pass header.d=messagingengine.com header.s=fm2 header.b=R04EHa4q; dmarc=pass (policy=none) header.from=sent.com; spf=pass (imf08.hostedemail.com: domain of zi.yan@sent.com designates 64.147.123.19 as permitted sender) smtp.mailfrom=zi.yan@sent.com ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1694636006; a=rsa-sha256; cv=none; b=4j41Wb/b4ixI+n5CY/Wuig2MBU66LOLm/ixn4U3sK1VjL2LhbPIJQi0eTlsluPn4FAs8Yx fzMq7rFw8VsECWT4RkwIxZGs8ZbIMLPlCC3+M3E+yKbHr3SpAiHiPS3od5EdOezQJDRgrq pmvXG93oG1Jf4QoeUUXEcZzl0MbA480= Received: from compute5.internal (compute5.nyi.internal [10.202.2.45]) by mailout.west.internal (Postfix) with ESMTP id 080353200931; Wed, 13 Sep 2023 16:13:23 -0400 (EDT) Received: from mailfrontend2 ([10.202.2.163]) by compute5.internal (MEProxy); Wed, 13 Sep 2023 16:13:25 -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= 1694636003; x=1694722403; bh=X7/kZB7lpmBCw2k1unMB2GujXf55nXH6oT8 ByqeAnAs=; b=CBOmFlmfdeIyUT89JnMFFy916vpAbJ9+Y0cZlpwErL9EqitXWZr uWr88udnznLV80ohjAvV5685ZWBBQEMoyF/qfcAqemAtrrEK8k2olxVb30YmPdUb Tlw0uK7KZPsGp+9j2OEfkrZzL3C4xkJNsEsDOva5YkPZKoeyPIr/gi7yBB1kbrNG XQ/I7z1bQqc9rOKkyTjShHd/+ahqxjRc4+Wxu3LFOY1SfwXY0murBB0Fl66mQpZj mc1dNZHIxQBFcfRzGoMNRSO+h6/Ikh4yrOGcLfNTjoXUcwObnu+yngcJ2fo4OrR/ TZHsqYmSk/VKyjpVhXMYY2cWckPbFTAE38w== 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= 1694636003; x=1694722403; bh=X7/kZB7lpmBCw2k1unMB2GujXf55nXH6oT8 ByqeAnAs=; b=R04EHa4qTG7s8rcZ3kVmP7mF3cLiCpbqwhsy5PJ+JwddtemnzQg CItzHuqb0aYBhWIBiGLIMyiQTfFeiTWpL+kSNDmPk6GkETnDAxmr6Nn2SVT+1vxp +i3Rdh3+cwEz1i4Z1IvmMlZ1edrQzgOpthPVnO5/0hfHMG/FsfUhmbGug0Cl0vqN MEcTlaWjY0Dnag15ONS44d/LdHbsl+wyeW+Lb5qXIwakLsnak8D7/ZiIJrn6psKI QtAKo0eOOGQrnQEiUSXWkkzeBXz61ifLsTqrqpNSflEXdMxnzJQltUpa4mWx5PoC 1PIex+iS2CJvgsszhUZhSBOnSzyc6//awNQ== X-ME-Sender: X-ME-Received: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgedviedrudeikedgudegiecutefuodetggdotefrod ftvfcurfhrohhfihhlvgemucfhrghsthforghilhdpqfgfvfdpuffrtefokffrpgfnqfgh necuuegrihhlohhuthemuceftddtnecusecvtfgvtghiphhivghnthhsucdlqddutddtmd enogfuohhrthgvugftvggtihhpvdculdegtddmnecujfgurhephffvvefufffkofgjfhhr ggfgsedtqhertdertddtnecuhfhrohhmpegkihcujggrnhcuoeiiihdrhigrnhesshgvnh htrdgtohhmqeenucggtffrrghtthgvrhhnpeeggeehudfgudduvdelheehteegledtteei veeuhfffveekhfevueefieeijeegvdenucevlhhushhtvghrufhiiigvpedunecurfgrrh grmhepmhgrihhlfhhrohhmpeiiihdrhigrnhesshgvnhhtrdgtohhm X-ME-Proxy: Feedback-ID: iccd040f4:Fastmail Received: by mail.messagingengine.com (Postfix) with ESMTPA; Wed, 13 Sep 2023 16:13:23 -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 Subject: [PATCH v3 5/5] mips: use nth_page() in place of direct struct page manipulation. Date: Wed, 13 Sep 2023 16:12:48 -0400 Message-Id: <20230913201248.452081-6-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 X-Rspamd-Queue-Id: 4C4E2160018 X-Rspam-User: X-Rspamd-Server: rspam02 X-Stat-Signature: 8pcjnnzfx8hnnayrujhcxdcsiz96fhrs X-HE-Tag: 1694636006-48809 X-HE-Meta: U2FsdGVkX1/J65ibf3bDZxdTgehyK2Qte7iwqkdUpLqJHtzAiPMguhFHhGD1WDB3RKSzsac/t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ZfOpAhXp8Zp1FlKti5ynP9Aebb/dfrRARQ9VCooUTm2zBii7vDA9ZY09Fcg0CxzESm7Od+FQw/X6q87zyQ5IWY2ua3nMpkLf0IhEhWSApd5EL3S0abcFvnzF118mJsKM0cgLxJwGv25+4wp+REnjd4PM39RCHu37GXCCYonLjWBlkXU52q+KLF1rVQhqJdofXpYXXaKL0T0Us9zJOvfITLZHVxVVgX13kRdBpkk3JYHfAMm81cufQCwqraxpgfEJeMUKWY5whulCWvjvn8WQwWVSePOIX7FudabNlzUXMmwPC/8P3YlP201RapxhTjEmL0ilaIOPvRwkFnkE8hlLxLqcgiNl 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. Fixes: 15fa3e8e3269 ("mips: implement the new page table range API") Cc: 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); }