Message ID | 20230228213738.272178-31-willy@infradead.org |
---|---|
State | New |
Headers |
Return-Path: <linux-kernel-owner@vger.kernel.org> Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:5915:0:0:0:0:0 with SMTP id v21csp3267413wrd; Tue, 28 Feb 2023 13:39:42 -0800 (PST) X-Google-Smtp-Source: AK7set9Mh8TTTg1LDN9CU7bSezH38jvQcXaF1vCLVbejlO/MHpfeM9+J3pe3hMk6rF0xMWJl+5/0 X-Received: by 2002:a05:6a20:3d02:b0:c9:9312:5f1d with SMTP id y2-20020a056a203d0200b000c993125f1dmr6316872pzi.4.1677620381751; Tue, 28 Feb 2023 13:39:41 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1677620381; cv=none; d=google.com; s=arc-20160816; b=l+J9BLO3FooKTBIkPH2kHtx2lyIK4hvtZCVYLnsSMPw2AQJVjvBHsxLSfUGJeTAEop secw5XLNfbUZ2UqhiG0LsTvq6lhGB2kRAgMxoD8FB5gFMVNK9f3C3mX008+GpzmrxcHe BSCh3qYL4cZOrRLifdYSI1rgHS9qwR/QnYXk8+7iUjxl/gK8vOOiddmxLUjXIHHOlRaW mI4cFqsalzqDdOr2LzdFFddAlG6NVs9M5qbeOsJ4eFZkaKMOsCLdOYwWdh20LuTd1BUZ 55x7+zUiPWyP9pgPvDFqnHiAnW7oSOscqUEuNnCji3F2ewbCuHtaA5pbSQ4DKjQa6/7O ywYQ== 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=Yzj6cO2/vJ4MfYZK59aIBqu3Kv7SFJ8gH5oZ5flVgEs=; b=U5GQhsWNkXSeOxDXyyf2JDQcCyiTsDdbZEkin/662vUdw/taWVuJsPygHlQMBv8H+H pAemv4B/OwEMY5hkn2dTivdle5wZzU26gyeT9k0bD4DDE1JgcLraJuU7eRWfVRF1riWA Q2GTgFeHwiEEXDODovaV7nrdB/+3v/aUumCmtMaXzypIpxBGIL/hr43HsZJ+3Km32uNq JJrB4/MCTrViwKWRxYdDzTTJiks1OBbgMnXmAC/aBNrmHT7qybsj/JnSxQybWQ+uwULr +yqC4FSQBiX0EuAemfRp3siTySxxqh+xUhwn30Dy06AQyGHlfnlOFbAMIDLtRtard9/N wceg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@infradead.org header.s=casper.20170209 header.b=OD1wQ9FR; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id s1-20020a632c01000000b004fc27d88c6fsi10027059pgs.592.2023.02.28.13.39.27; Tue, 28 Feb 2023 13:39:41 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@infradead.org header.s=casper.20170209 header.b=OD1wQ9FR; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229973AbjB1Vir (ORCPT <rfc822;aaron.seo0120@gmail.com> + 99 others); Tue, 28 Feb 2023 16:38:47 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:51690 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229990AbjB1ViF (ORCPT <rfc822;linux-kernel@vger.kernel.org>); Tue, 28 Feb 2023 16:38:05 -0500 Received: from casper.infradead.org (casper.infradead.org [IPv6:2001:8b0:10b:1236::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 1AE8C35274; Tue, 28 Feb 2023 13:37:45 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=casper.20170209; h=Content-Transfer-Encoding:MIME-Version: References:In-Reply-To:Message-Id:Date:Subject:Cc:To:From:Sender:Reply-To: Content-Type:Content-ID:Content-Description; bh=Yzj6cO2/vJ4MfYZK59aIBqu3Kv7SFJ8gH5oZ5flVgEs=; b=OD1wQ9FRkxcghMLJg6Ce5C0ga2 cmeah8bBnDlnApT7w9eP4jLoOHWe5LOWJvaXjzySJToJ/ri5lFa/WPRrYlKCBfTnoTOy61IeVDPmi 68qgaO505JobxikfyskgY9xbNje+JqFPUysl0cnN+vEVR3pgREX8J89OLKMHl/TqyyAVjEpnol4zA mWNvomzEhL2O9QcgO/0OOrJvu8ccybEFryAof/kx97tzFyUluCPOeKa3/0cjX3UTPkb/j9069P53J +Cg4IG3uFwzyjrZHabcHWuf84tIb4VxnYUxvHW0kGOEgevnxc29eSy5Y6qNTUzaF2UnG761WUlGH0 nbiy8g/A==; Received: from willy by casper.infradead.org with local (Exim 4.94.2 #2 (Red Hat Linux)) id 1pX7fL-0018qr-6O; Tue, 28 Feb 2023 21:37:43 +0000 From: "Matthew Wilcox (Oracle)" <willy@infradead.org> To: linux-mm@kvack.org, linux-arch@vger.kernel.org Cc: "Matthew Wilcox (Oracle)" <willy@infradead.org>, linux-kernel@vger.kernel.org Subject: [PATCH v3 30/34] mm: Use flush_icache_pages() in do_set_pmd() Date: Tue, 28 Feb 2023 21:37:33 +0000 Message-Id: <20230228213738.272178-31-willy@infradead.org> X-Mailer: git-send-email 2.37.1 In-Reply-To: <20230228213738.272178-1-willy@infradead.org> References: <20230228213738.272178-1-willy@infradead.org> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-4.4 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_MED,SPF_HELO_NONE, SPF_NONE 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: <linux-kernel.vger.kernel.org> X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1759112469744372791?= X-GMAIL-MSGID: =?utf-8?q?1759112469744372791?= |
Series |
New page table range API
|
|
Commit Message
Matthew Wilcox
Feb. 28, 2023, 9:37 p.m. UTC
Push the iteration over each page down to the architectures (many
can flush the entire THP without iteration).
Signed-off-by: Matthew Wilcox (Oracle) <willy@infradead.org>
---
mm/memory.c | 3 +--
1 file changed, 1 insertion(+), 2 deletions(-)
Comments
On Tue, Feb 28, 2023 at 09:37:33PM +0000, Matthew Wilcox (Oracle) wrote: > Push the iteration over each page down to the architectures (many > can flush the entire THP without iteration). > > Signed-off-by: Matthew Wilcox (Oracle) <willy@infradead.org> > --- > mm/memory.c | 3 +-- > 1 file changed, 1 insertion(+), 2 deletions(-) > > diff --git a/mm/memory.c b/mm/memory.c > index bfa3100ec5a3..69e844d5f75c 100644 > --- a/mm/memory.c > +++ b/mm/memory.c > @@ -4222,8 +4222,7 @@ vm_fault_t do_set_pmd(struct vm_fault *vmf, struct page *page) > if (unlikely(!pmd_none(*vmf->pmd))) > goto out; > > - for (i = 0; i < HPAGE_PMD_NR; i++) > - flush_icache_page(vma, page + i); > + flush_icache_pages(vma, page, HPAGE_PMD_NR); > > entry = mk_huge_pmd(page, vma->vm_page_prot); > if (write) > -- > 2.39.1 I get this: CC mm/memory.o /home/mike/git/linux/mm/memory.c: In function 'do_set_pmd': /home/mike/git/linux/mm/memory.c:4191:13: warning: unused variable 'i' [-Wunused-variable] 4191 | int i; | ^ And the patch here makes it go away: diff --git a/mm/memory.c b/mm/memory.c index cc7845ff09ba..c359fb8643e5 100644 --- a/mm/memory.c +++ b/mm/memory.c @@ -4188,7 +4188,6 @@ vm_fault_t do_set_pmd(struct vm_fault *vmf, struct page *page) bool write = vmf->flags & FAULT_FLAG_WRITE; unsigned long haddr = vmf->address & HPAGE_PMD_MASK; pmd_t entry; - int i; vm_fault_t ret = VM_FAULT_FALLBACK; if (!transhuge_vma_suitable(vma, haddr))
On Fri, Mar 03, 2023 at 04:02:01PM +0200, Mike Rapoport wrote: > On Tue, Feb 28, 2023 at 09:37:33PM +0000, Matthew Wilcox (Oracle) wrote: > > Push the iteration over each page down to the architectures (many > > can flush the entire THP without iteration). > > > > Signed-off-by: Matthew Wilcox (Oracle) <willy@infradead.org> > > --- > > mm/memory.c | 3 +-- > > 1 file changed, 1 insertion(+), 2 deletions(-) > > > > diff --git a/mm/memory.c b/mm/memory.c > > index bfa3100ec5a3..69e844d5f75c 100644 > > --- a/mm/memory.c > > +++ b/mm/memory.c > > @@ -4222,8 +4222,7 @@ vm_fault_t do_set_pmd(struct vm_fault *vmf, struct page *page) > > if (unlikely(!pmd_none(*vmf->pmd))) > > goto out; > > > > - for (i = 0; i < HPAGE_PMD_NR; i++) > > - flush_icache_page(vma, page + i); > > + flush_icache_pages(vma, page, HPAGE_PMD_NR); > > > > entry = mk_huge_pmd(page, vma->vm_page_prot); > > if (write) > > -- > > 2.39.1 > > I get this: > > CC mm/memory.o > /home/mike/git/linux/mm/memory.c: In function 'do_set_pmd': > /home/mike/git/linux/mm/memory.c:4191:13: warning: unused variable 'i' [-Wunused-variable] > 4191 | int i; Yep, caught that one last night. My build test must have been with a config that didn't include THP. Thanks.
diff --git a/mm/memory.c b/mm/memory.c index bfa3100ec5a3..69e844d5f75c 100644 --- a/mm/memory.c +++ b/mm/memory.c @@ -4222,8 +4222,7 @@ vm_fault_t do_set_pmd(struct vm_fault *vmf, struct page *page) if (unlikely(!pmd_none(*vmf->pmd))) goto out; - for (i = 0; i < HPAGE_PMD_NR; i++) - flush_icache_page(vma, page + i); + flush_icache_pages(vma, page, HPAGE_PMD_NR); entry = mk_huge_pmd(page, vma->vm_page_prot); if (write)