Received: by 2002:a05:6358:700f:b0:131:369:b2a3 with SMTP id 15csp1179285rwo; Wed, 2 Aug 2023 09:50:02 -0700 (PDT) X-Google-Smtp-Source: APBJJlHuAFDrkn8zQTWUI5lPNTRYideFwYF/wo0GbqNtnP7DFeEzg3D5AEIT34RmQWcAZ2g/tSpF X-Received: by 2002:a05:6512:3ba8:b0:4fb:8948:2b28 with SMTP id g40-20020a0565123ba800b004fb89482b28mr6937440lfv.63.1690995001958; Wed, 02 Aug 2023 09:50:01 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1690995001; cv=none; d=google.com; s=arc-20160816; b=ALkMbITnN3pU8XhUrhgZ3dnyqS6XYiaRe289UojCWIX2ZlpdEplynhCrbiX5I3sW0s pqhgl9sc8t+BJccIsqVOBcN/OueOvzRf8MzAaifk0radvc6jGcUH0F/EKreq0GivgqkJ 23EPfA8xNn8tqyJqRyHFl3N5LQd2izS5ycLX3rEOukQQ72K+qFda0hMVQzj+sBsCLzeZ 7FPWZRZQkDUI9ad6QFV459kJbEVWD0LUAsufEp37Gy2y9KMuTGgsTo9ELbsvruE5SpIY 8YUw2eWcJkzADCHmN1iGIeMlXps2sD5fUkn/K3dolFw59tcG/xNn7YWTHDH7yiYnry0/ 1qOw== 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=Lo+Ghw1793UV9pKFBxkz2iQJ13EHx7xbrSdwvVIFCO0=; fh=YSRXgHJFLntr8RR5WDr+xEuSZ7CBE2Ww6sl4CKuWw+A=; b=Ue7MMZyz/tjq6EoHP0CwTo5uVuhcC6Wkbslg2CNzrOoGX3ip91g9vS5V2Yoym10L5+ FMYod97MRYNqWhxoAMqt2MwloP8GHSCojLD7sKT2s3hlzVigFP/Sc3GKzijY9CxandWq 6hI3ICX8bCpCWF3ro91vV0HW7RFxZOxJcPb1HwlZHdOitwotFbjOfC1ThIAtRZ2wfgGy 6jSGfz14JnBAjRQVaSx2ZqYJgpXeLXcXTOW0XZniuWc0y8/87EhayAL705OHkk2QWlPD D/32zYUsz2+wFi6nBU5nKZK5/UXnlsaQKwWP4O8wLM8UGB+iDiW2U/a5v9f6jr/um2Ql OgdQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@infradead.org header.s=casper.20170209 header.b=StoT9OIc; 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 Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id d5-20020a056402078500b00522d83e503bsi4082599edy.167.2023.08.02.09.49.36; Wed, 02 Aug 2023 09:50:01 -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=StoT9OIc; 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 S235179AbjHBPQJ (ORCPT + 99 others); Wed, 2 Aug 2023 11:16:09 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:37464 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234340AbjHBPOX (ORCPT ); Wed, 2 Aug 2023 11:14:23 -0400 Received: from casper.infradead.org (casper.infradead.org [IPv6:2001:8b0:10b:1236::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id C352C30DE; Wed, 2 Aug 2023 08:14:16 -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=Lo+Ghw1793UV9pKFBxkz2iQJ13EHx7xbrSdwvVIFCO0=; b=StoT9OIcj4o9toRzc4/BXdHg8D Zh68QjCQw2PFRHdenUP0R510VbFMjlweCeuIVsR143Psl/lZf3/pdVFFdbFtG7AS6OLIJvd+r6nQk l/QSbIb5Mb2rd1E3BCU2csUdLClDSM+kvDV2rua3Z8j0RDXsiOBNFMuqoD5JXmhBJ4BwNEVD8r2KW y5CulEBiJDFztXAXSYnIkSDrl/3IDADBmpukaYHdOjjK/Wz7yqWQ1ISRRmhkY8IQuRnTAp1csTfE7 v47kAGtE0q/L/4klerCgiyAuXUgH6GqD8/CkrDsNoedZlhzGkRZBoeMxn7JJ0esryenRXCyn+gEwt 6d+qo20g==; Received: from willy by casper.infradead.org with local (Exim 4.94.2 #2 (Red Hat Linux)) id 1qRDYB-00Ffle-QB; Wed, 02 Aug 2023 15:14:11 +0000 From: "Matthew Wilcox (Oracle)" To: Andrew Morton Cc: "Matthew Wilcox (Oracle)" , linux-arch@vger.kernel.org, linux-mm@kvack.org, linux-kernel@vger.kernel.org, Anshuman Khandual Subject: [PATCH v6 33/38] mm: Use flush_icache_pages() in do_set_pmd() Date: Wed, 2 Aug 2023 16:14:01 +0100 Message-Id: <20230802151406.3735276-34-willy@infradead.org> X-Mailer: git-send-email 2.37.1 In-Reply-To: <20230802151406.3735276-1-willy@infradead.org> References: <20230802151406.3735276-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,T_SCC_BODY_TEXT_LINE,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 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 4e6e9ec7eaaf..e25edd4c24b8 100644 --- a/mm/memory.c +++ b/mm/memory.c @@ -4400,7 +4400,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)) @@ -4433,8 +4432,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.40.1