From patchwork Wed Mar 15 05:14:40 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Matthew Wilcox X-Patchwork-Id: 69967 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:5915:0:0:0:0:0 with SMTP id v21csp2149912wrd; Tue, 14 Mar 2023 22:35:29 -0700 (PDT) X-Google-Smtp-Source: AK7set+59+BrHYUBAyZUfEWCPS+7bVRiJI2LzRBzOSbvMA678CN3ste4E2WwKlYXwye8yPXm3cSD X-Received: by 2002:a17:902:d50f:b0:19a:a305:e367 with SMTP id b15-20020a170902d50f00b0019aa305e367mr1308334plg.30.1678858529050; Tue, 14 Mar 2023 22:35:29 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1678858529; cv=none; d=google.com; s=arc-20160816; b=aAABLaHY/fkgO7CYBJagHNxvqS3YwTvhtZpIuc/7YSfgcC0fWg59hP33EyfiIjF0SL Dgo5DcOpT2O65AC+C0mgsRHpLTHaUDXGuP2N7HTSWSlBHw8bctkqvXnxXVhPt/Psh2g7 s01EfYeOR9DVAjzEXq++suwIQH+CbiOG3Nu14rBD7vi4F8twMiIptAiet37YBi5WXoKh fVFQ8iQ/yxZpFaJ0T8ilz6t0xmIZuku8yuRsWfmIOd6Iixh4JyeRCiyX5sgfqec6AyTJ mN1mhrIwdht+hF2MpnqM0tpR2um7lNw7c0mzwpDzR4/rayjE0J6QOEnciBMn73lmyasv P6UA== 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=73ezd5W5E0KEIO6VAvV47amCBEQJWRQwkcGKvspT3vU=; b=WRzy56XIKt+2TZdDK5jSEYc5eDtF7vpDt8U/BNSkaa/mbX8GdhbU55qLyu+CfVem0K R2Q8m4R4TVgcCZ6kHx9Ff0Q7v041DHDEbrnChh53pzErsUT8GCGCtrM3ZF+c5qP8WBO5 hLwwk34BgR9hRdgG/AiJ58s4hjvwT7N5UtwVC8QZzVYMAniM78cYaDFbmEYopVR+DbKp ad7XQIqifLyxn/yp9qAJxLm5kTGYPqU3cXRHwhzs5eI6vj4n0bmegfttj/QSm0EMn8SG KGjFUTzKLrF1df1DQa3F3zzHAsx1+Rfae2bOjsuyGvQ48KRGyxCZcIo6IV+GwMaWClJp CM0w== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@infradead.org header.s=casper.20170209 header.b=masNXlur; 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 ky4-20020a170902f98400b0019e6a5cf724si4396315plb.203.2023.03.14.22.35.14; Tue, 14 Mar 2023 22:35:29 -0700 (PDT) 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=masNXlur; 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 S231650AbjCOFQu (ORCPT + 99 others); Wed, 15 Mar 2023 01:16:50 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:48724 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229734AbjCOFPJ (ORCPT ); Wed, 15 Mar 2023 01:15:09 -0400 Received: from casper.infradead.org (casper.infradead.org [IPv6:2001:8b0:10b:1236::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 4009136699; Tue, 14 Mar 2023 22:14:55 -0700 (PDT) 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=73ezd5W5E0KEIO6VAvV47amCBEQJWRQwkcGKvspT3vU=; b=masNXlurESfGKFlz8RtpG3Ix6m c4wAtigik6OB2AQV5nlqZHF40DQ4SrO2QghheJqdi4JolrLkVBcE9Yd5IK23rR+n/r9h/QmMvK3ZU ElD/3Y4EjDSwQH54M0hFmcONJ2bo+CjcPl3G4AygvaJU0Cy5Gbnnz96Ye7+TAf8rujSVl7nV0lHh/ 7yqn+jtIlBnnXwW3QX20uiMY39Vi/D9atJNh43Eq4qt5SiXsDTJP2Fou6RtcgrVPwLb0vLi/HTe/3 ktJdJDSo3K4fmYtt1pytHUU5UYwNDRF45mZX+FvpApd2hzNqngqiie8i8+JYj9OeATVTI+fXiWYGQ H271YV6Q==; Received: from willy by casper.infradead.org with local (Exim 4.94.2 #2 (Red Hat Linux)) id 1pcJTO-00DYDg-CJ; Wed, 15 Mar 2023 05:14:50 +0000 From: "Matthew Wilcox (Oracle)" To: linux-arch@vger.kernel.org Cc: "Matthew Wilcox (Oracle)" , linux-mm@kvack.org, linux-kernel@vger.kernel.org Subject: [PATCH v4 32/36] mm: Use flush_icache_pages() in do_set_pmd() Date: Wed, 15 Mar 2023 05:14:40 +0000 Message-Id: <20230315051444.3229621-33-willy@infradead.org> X-Mailer: git-send-email 2.37.1 In-Reply-To: <20230315051444.3229621-1-willy@infradead.org> References: <20230315051444.3229621-1-willy@infradead.org> MIME-Version: 1.0 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,URIBL_BLOCKED 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-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1760410760989309304?= X-GMAIL-MSGID: =?utf-8?q?1760410760989309304?= Push the iteration over each page down to the architectures (many can flush the entire THP without iteration). Signed-off-by: Matthew Wilcox (Oracle) Reviewed-by: Anshuman Khandual --- mm/memory.c | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/mm/memory.c b/mm/memory.c index c5f1bf906d0c..6aa21e8f3753 100644 --- a/mm/memory.c +++ b/mm/memory.c @@ -4209,7 +4209,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)) @@ -4242,8 +4241,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)