Received: by 2002:a05:7412:37c9:b0:e2:908c:2ebd with SMTP id jz9csp2400856rdb; Thu, 21 Sep 2023 18:47:06 -0700 (PDT) X-Google-Smtp-Source: AGHT+IFD6v5jUDE8k4TFcTiCwddPop1+haB0ZKTlHTCR+cz96Os/nym9VStM/PafmGcv2+lCnya4 X-Received: by 2002:a05:6a00:1789:b0:68b:e18f:2eb7 with SMTP id s9-20020a056a00178900b0068be18f2eb7mr7416435pfg.1.1695347226503; Thu, 21 Sep 2023 18:47:06 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1695347226; cv=none; d=google.com; s=arc-20160816; b=NdDOxrx1zcYslxNQ8NBUsrEWjBwbw1qdrH2ZqZB/BWLBZah/3mz83PBNMHgbrpsLF/ HizuPBMyzNCLDzNvif/+m2bm1jp1AgTbNBRh0UApIUaH58RD8AHEvYhzFQ5SjjNnrwXm vDxYzD9BB/qy9BcevbjE5tuU6hwzlScgnio0LdBDXnv78QCws0M2bHobb5baIwAvXEvm ceXlcVClSN38ngMfzQk8uf6OD56tIG02R5690oLEiygXj7H97RaXPGUemcrW2J1hLYfm 9r8Cr04tGxEKmA8jwa5rurQjNQMT+RAKmYb9OOVNJ2qfDq8yQPQQ2cJ5C/Ymi/Gy7Ev5 pwrA== 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 :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=Iw9p+SEu2S1WjSUeJzrGQC466A/Q0XA+n0pDx3edO4c=; fh=3Xk4+vFmQ/aZ6Ld63Q/G6EEom2SUW7UbUuf6epiOar0=; b=x1q677QAgPjS0rWNa+Gf2xP7uSe8Iro2K9uL27JMUsIXMN4VFtRMPgDorpL0YN5rcJ inWwGlABdFQnkdB0bwVMzqyD5kTBZAxtOfG96TkL6o//pWRr0O2bVdliS+bkUTcmSMFS sRqTYfke5BBLn/N9w5+m2kYIZ3Pdl9akN+GzpHXZtcIQJhC4OUoorsybCm1gBw+SbBdH wnwfq1EC3KApIc74MAB6Oz2IRi2WixU+zLvZqQOfCqdIkIonEsOfFw1ptMNnA2UZ4anr Pt2IIZjoaUfTc5IqzINo+UErKmqtyktO0ZlpfepMVSforD1+DWSO32CeL4JrG8hDtoqW AI6w== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=PNAAsjxZ; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.37 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from snail.vger.email (snail.vger.email. [23.128.96.37]) by mx.google.com with ESMTPS id e26-20020a63545a000000b00578b21f1890si2718723pgm.294.2023.09.21.18.47.06 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 21 Sep 2023 18:47:06 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.37 as permitted sender) client-ip=23.128.96.37; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=PNAAsjxZ; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.37 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by snail.vger.email (Postfix) with ESMTP id 9B7CD809E721; Thu, 21 Sep 2023 18:37:20 -0700 (PDT) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.10 at snail.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230162AbjIVBhW (ORCPT + 99 others); Thu, 21 Sep 2023 21:37:22 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:56312 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229497AbjIVBhW (ORCPT ); Thu, 21 Sep 2023 21:37:22 -0400 Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id ECDF2F5; Thu, 21 Sep 2023 18:37:15 -0700 (PDT) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 2723CC433C8; Fri, 22 Sep 2023 01:37:13 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1695346635; bh=zRyL223DT0AFJx1gaOEUn6WcLlX2Kysk+6Fs0mtLrOo=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=PNAAsjxZ/e5mSgGg/LPftlkbNKpcN/rnJGyJdb//w0VkNEAdvtPkglz83EUpi+iRP CUifgPcEfIXikkO8FSBVWAewa4zbTOyW/Yl5flrqUDllqJAE3SzG2kmjrjAZrmJDHo crbAM8SWYY+JnkBboXDn+/Qz7CHhlgXE7xG/2qP2x0dmB0tprvlPXeP9NzkYvk+r3s 0uxngMBI0XN0BvxVhCId+ACbyTDCZOXDjS5wdL3TxpEGcwtg23dBoXZkT0xPOs4c86 SSz1LUNN37N0YRjVtKgcGjRfXwPjXi9P2JOPVjrrrvT7bUtXub+Siisb+MvwlrdxSE a+KWdAyrmeGOA== From: SeongJae Park To: Ryan Roberts Cc: Will Deacon , "James E.J. Bottomley" , Helge Deller , Nicholas Piggin , Christophe Leroy , Paul Walmsley , Palmer Dabbelt , Albert Ou , Heiko Carstens , Vasily Gorbik , Alexander Gordeev , Christian Borntraeger , Sven Schnelle , Gerald Schaefer , "David S. Miller" , Arnd Bergmann , Mike Kravetz , Muchun Song , SeongJae Park , Andrew Morton , Uladzislau Rezki , Christoph Hellwig , Lorenzo Stoakes , Anshuman Khandual , Peter Xu , Axel Rasmussen , Qi Zheng , linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, linux-parisc@vger.kernel.org, linuxppc-dev@lists.ozlabs.org, linux-riscv@lists.infradead.org, linux-s390@vger.kernel.org, sparclinux@vger.kernel.org, linux-mm@kvack.org, stable@vger.kernel.org Subject: Re: [PATCH v1 6/8] mm: hugetlb: Convert set_huge_pte_at() to take vma Date: Fri, 22 Sep 2023 01:37:11 +0000 Message-Id: <20230922013711.100278-1-sj@kernel.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20230921162007.1630149-7-ryan.roberts@arm.com> References: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF, RCVD_IN_DNSWL_BLOCKED,SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net 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 (snail.vger.email [0.0.0.0]); Thu, 21 Sep 2023 18:37:20 -0700 (PDT) Hi Ryan, On Thu, 21 Sep 2023 17:20:05 +0100 Ryan Roberts wrote: > In order to fix a bug, arm64 needs access to the vma inside it's > implementation of set_huge_pte_at(). Provide for this by converting the > mm parameter to be a vma. Any implementations that require the mm can > access it via vma->vm_mm. > > This commit makes the required modifications to the core mm. Separate > commits update the arches, before the actual bug is fixed in arm64. > > No behavioral changes intended. > > Signed-off-by: Ryan Roberts For mm/damon/ part change, Reviewed-by: SeongJae Park Thanks, SJ > --- > include/asm-generic/hugetlb.h | 6 +++--- > include/linux/hugetlb.h | 6 +++--- > mm/damon/vaddr.c | 2 +- > mm/hugetlb.c | 30 +++++++++++++++--------------- > mm/migrate.c | 2 +- > mm/rmap.c | 10 +++++----- > mm/vmalloc.c | 5 ++++- > 7 files changed, 32 insertions(+), 29 deletions(-) > > diff --git a/include/asm-generic/hugetlb.h b/include/asm-generic/hugetlb.h > index 4da02798a00b..515e4777fb65 100644 > --- a/include/asm-generic/hugetlb.h > +++ b/include/asm-generic/hugetlb.h > @@ -75,10 +75,10 @@ static inline void hugetlb_free_pgd_range(struct mmu_gather *tlb, > #endif > > #ifndef __HAVE_ARCH_HUGE_SET_HUGE_PTE_AT > -static inline void set_huge_pte_at(struct mm_struct *mm, unsigned long addr, > - pte_t *ptep, pte_t pte) > +static inline void set_huge_pte_at(struct vm_area_struct *vma, > + unsigned long addr, pte_t *ptep, pte_t pte) > { > - set_pte_at(mm, addr, ptep, pte); > + set_pte_at(vma->vm_mm, addr, ptep, pte); > } > #endif > > diff --git a/include/linux/hugetlb.h b/include/linux/hugetlb.h > index 5b2626063f4f..08184f32430c 100644 > --- a/include/linux/hugetlb.h > +++ b/include/linux/hugetlb.h > @@ -984,7 +984,7 @@ static inline void huge_ptep_modify_prot_commit(struct vm_area_struct *vma, > unsigned long addr, pte_t *ptep, > pte_t old_pte, pte_t pte) > { > - set_huge_pte_at(vma->vm_mm, addr, ptep, pte); > + set_huge_pte_at(vma, addr, ptep, pte); > } > #endif > > @@ -1172,8 +1172,8 @@ static inline pte_t huge_ptep_clear_flush(struct vm_area_struct *vma, > #endif > } > > -static inline void set_huge_pte_at(struct mm_struct *mm, unsigned long addr, > - pte_t *ptep, pte_t pte) > +static inline void set_huge_pte_at(struct vm_area_struct *vma, > + unsigned long addr, pte_t *ptep, pte_t pte) > { > } > > diff --git a/mm/damon/vaddr.c b/mm/damon/vaddr.c > index 4c81a9dbd044..55da8cee8fbc 100644 > --- a/mm/damon/vaddr.c > +++ b/mm/damon/vaddr.c > @@ -347,7 +347,7 @@ static void damon_hugetlb_mkold(pte_t *pte, struct mm_struct *mm, > if (pte_young(entry)) { > referenced = true; > entry = pte_mkold(entry); > - set_huge_pte_at(mm, addr, pte, entry); > + set_huge_pte_at(vma, addr, pte, entry); > } > > #ifdef CONFIG_MMU_NOTIFIER [...] Thanks, SJ