Received: by 2002:a05:7412:31a9:b0:e2:908c:2ebd with SMTP id et41csp3508246rdb; Wed, 13 Sep 2023 14:24:22 -0700 (PDT) X-Google-Smtp-Source: AGHT+IFckxVF9Vd3VcCQJQ5DAvriFLAYs+drqqsi6k/kW2kvJuQva/oJAS0BHIAIVYfVTFeK2mA5 X-Received: by 2002:a05:6808:2209:b0:3a8:443b:d87b with SMTP id bd9-20020a056808220900b003a8443bd87bmr4828564oib.34.1694640262496; Wed, 13 Sep 2023 14:24:22 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1694640262; cv=none; d=google.com; s=arc-20160816; b=k61z0fD397snpLGweC7bjXMFw4iqex4EQi+J/pJFsQT8zwSaxw57V7MYGRjH1D5bGj u7+KTWl39SgnP+o/QymZx9l7T8Dm/hn2N1h3kAQdIAinnBsEtMizrOH11vZ336ObLxTD Lb0I7uTrJ9pXC/4h2eV4/zwG9bkl4bw9Wv0iZRccT7eKJ9RQz2ieTDuiutXh4hmuvosh ndVINdeFZuKl2xoCDGPn3uYN0Fn0lv9QpOGYrKeXw4KzEVU4MqVhQglkPZo8nJR0KKBM V+GXFXMqmmqRJxgLHrk0FtyQn8vDnymVSsyAiBuiQ3wVayV8oLV4xo4q75TnNv/0rDMB 0iXQ== 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 :references:in-reply-to:message-id:date:subject:cc:to:from :feedback-id:dkim-signature:dkim-signature; bh=X7/kZB7lpmBCw2k1unMB2GujXf55nXH6oT8ByqeAnAs=; fh=GxieLooCEvcBpEBw8LOqYAxw58VqH9EOnAcolEICVqM=; b=tigQ9av8xnklG6xGAJSR6FKZ/WfcO0WbhH1R+myL4LCMTwA40kzl74DmhNAmVh6QIT qobxfqw90y+eEupg7rRl2Q9TPqw1zCvkbOwaJMjcMqKh0YZaT+6nPdRzZpBhtatO6lPD P0maOAISsAW4VAbuUeYpD1x0OTygk5E9WEkLAb4QhYfCTlhTDMR83gt2UPaZusclzNJc vc/UBm0eMwhxH+7VNwZ4exTzU1WLzJFdd5XFqoa09ThxQatS3bhNW9QARHUAGMc+vkbF agSF7ewrWbi1kPssjKwwvzR5GOvVwzzPi/OHTqmCCudf6smR7gQoXfI4LLYRsnfY3f7K iGhw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@sent.com header.s=fm2 header.b=CBOmFlmf; dkim=pass header.i=@messagingengine.com header.s=fm2 header.b=R04EHa4q; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:8 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=sent.com Return-Path: Received: from fry.vger.email (fry.vger.email. [2620:137:e000::3:8]) by mx.google.com with ESMTPS id f10-20020a056a00228a00b0068fadbc3169si78473pfe.254.2023.09.13.14.24.21 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 13 Sep 2023 14:24:22 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:8 as permitted sender) client-ip=2620:137:e000::3:8; Authentication-Results: mx.google.com; dkim=pass header.i=@sent.com header.s=fm2 header.b=CBOmFlmf; dkim=pass header.i=@messagingengine.com header.s=fm2 header.b=R04EHa4q; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:8 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 fry.vger.email (Postfix) with ESMTP id F241181F54DE; Wed, 13 Sep 2023 13:13:46 -0700 (PDT) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.10 at fry.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232749AbjIMUNl (ORCPT + 99 others); Wed, 13 Sep 2023 16:13:41 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:41630 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232173AbjIMUNc (ORCPT ); Wed, 13 Sep 2023 16:13:32 -0400 Received: from wout3-smtp.messagingengine.com (wout3-smtp.messagingengine.com [64.147.123.19]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id D5A051BCA; Wed, 13 Sep 2023 13:13:25 -0700 (PDT) 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 Content-Transfer-Encoding: quoted-printable 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 (fry.vger.email [0.0.0.0]); Wed, 13 Sep 2023 13:13:47 -0700 (PDT) X-Spam-Status: No, score=-0.6 required=5.0 tests=DKIM_SIGNED,DKIM_VALID, DKIM_VALID_AU,FREEMAIL_FORGED_FROMDOMAIN,FREEMAIL_FROM, HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,SPF_HELO_NONE, SPF_PASS autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on fry.vger.email 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 i= nt nr) * get faulted into the tlb (and thus flushed) anyways. */ for (i =3D 0; i < nr; i++) { - addr =3D (unsigned long)kmap_local_page(page + i); + addr =3D (unsigned long)kmap_local_page(nth_page(page, i)); flush_data_cache_page(addr); kunmap_local((void *)addr); } --=20 2.40.1