From patchwork Mon Jul 10 20:43:34 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Matthew Wilcox X-Patchwork-Id: 118092 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:a6b2:0:b0:3e4:2afc:c1 with SMTP id c18csp67428vqm; Mon, 10 Jul 2023 13:57:32 -0700 (PDT) X-Google-Smtp-Source: APBJJlHbl/VpI5YrqNYywJ1k0vJ+6IUQdSswXvQlHn76AFveMco86CVkiJu2DvoZnJVsIYkL/z0Q X-Received: by 2002:a05:6808:6399:b0:398:5d57:3d08 with SMTP id ec25-20020a056808639900b003985d573d08mr11782242oib.37.1689022652379; Mon, 10 Jul 2023 13:57:32 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1689022652; cv=none; d=google.com; s=arc-20160816; b=DVEtFKLc3Mq2vWxkI49EwupaEmLwC1hRM+GhG9hUfdQKr0edzpjXdAd+/yWRmekrOe 5UfLLl8O2h0MCsxWBaCBr1vIaKh7g5PFxzM1eqzZnmDB/nJHJcj3IN+anMAGfRmWbjuc jBevnJZf1kXWh7DSqEjEpNtzvPs/KEAPVfJOpI8LNipRvvdMsWd57BoJUtBUkkS30EGt 0xXTx57zhf33suIwmYWCI+a3a6jp0ibZUiXq9OIs6ini4LpAER837p2TDDbTb9Mbc0Ix WypVpNUahI3ydZDH1qHHgM9msrn9jemjQEie9jqfSuG5CUB7+oo8rzak+AwS982Oh96n LooQ== 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=paPNbsDhrgFpFK66NfUXWHVPB3cHJyjAQhVhGRR5N+U=; fh=YSRXgHJFLntr8RR5WDr+xEuSZ7CBE2Ww6sl4CKuWw+A=; b=hmw4ftyeLOotDjDVUUlqxwE4lW0fWPiIb+NtajWPwPPhgLWJDHn/gLD/YW+mL1VQS5 DOffEpQV9gfPtepaB9kI+9pPiZr+pOo4HcDbCCLKJnDRB8rVI6m2TnFRyvsEgi3+oWCp uwrUZ9X5EU8G2m9Jyv7RyFk0YWUCs0OGA7Ft06QJkwthrc2461i7KJUxAdbor2kRvTiH WhzWowBUMgIUQScc9Bfu80EmPGgEwqmipjr28Efs7fMv1P3Is0CiTHOzv7fdjtqa1QBV yvh+QdH1pTQxv8g7gRw4lIbYuukMyXOoxxq3RID7mlzALi/get0B9zoHxZR4QQrl/Um1 4vTg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@infradead.org header.s=casper.20170209 header.b=QUlAJhWR; 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 e24-20020a656798000000b005533cf1fdbfsi195413pgr.629.2023.07.10.13.57.18; Mon, 10 Jul 2023 13:57:32 -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=QUlAJhWR; 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 S233074AbjGJUpX (ORCPT + 99 others); Mon, 10 Jul 2023 16:45:23 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:49354 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232237AbjGJUoF (ORCPT ); Mon, 10 Jul 2023 16:44:05 -0400 Received: from casper.infradead.org (casper.infradead.org [IPv6:2001:8b0:10b:1236::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id C6BDF1A2; Mon, 10 Jul 2023 13:43:46 -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=paPNbsDhrgFpFK66NfUXWHVPB3cHJyjAQhVhGRR5N+U=; b=QUlAJhWRNtFfmO7LZAtZUSyWv3 Yj6u2SE4iI6rFGiFOGHlKsUXxIapWLmZWsYfFAYfENSbb4vLwByEs/6XN1nlTK/hyUof5bWAqj1dj LAku+E4ib0zFnv5xeOROvKW4KEucJNW8DbWcT3FawboddIGTkkMdxX4Bs8w+dO3NhVWk2WVx6hLdJ kFvVs8KfTUMemf+kCGffTtHBOEI0wVNJSzi+cXICOq1HuBI6x+sns9KcpYKYB016jvQ5PEw2PlHJ+ UhkJM6mqe3VtGclFhhf+B9SFjdYsrGwJt82VnL86dE6lfhahmjlfo6re3zLgz8LCtNU5D8iJrUlh9 LshlmaPw==; Received: from willy by casper.infradead.org with local (Exim 4.94.2 #2 (Red Hat Linux)) id 1qIxjU-00Eur6-Sh; Mon, 10 Jul 2023 20:43:44 +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 v5 33/38] mm: Use flush_icache_pages() in do_set_pmd() Date: Mon, 10 Jul 2023 21:43:34 +0100 Message-Id: <20230710204339.3554919-34-willy@infradead.org> X-Mailer: git-send-email 2.37.1 In-Reply-To: <20230710204339.3554919-1-willy@infradead.org> References: <20230710204339.3554919-1-willy@infradead.org> MIME-Version: 1.0 X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_BLOCKED, SPF_HELO_NONE,SPF_NONE,T_SCC_BODY_TEXT_LINE 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: INBOX X-GMAIL-THRID: 1771068616436581774 X-GMAIL-MSGID: 1771068616436581774 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 1dada20e3995..ebb4138acdb2 100644 --- a/mm/memory.c +++ b/mm/memory.c @@ -4258,7 +4258,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)) @@ -4291,8 +4290,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)