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: 13307615 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by smtp.lore.kernel.org (Postfix) with ESMTP id 3A4C5EB64DC for ; Mon, 10 Jul 2023 20:44:16 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 161EE8E000F; Mon, 10 Jul 2023 16:43:50 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id F04D88E0011; Mon, 10 Jul 2023 16:43:49 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 7F0E18E0012; Mon, 10 Jul 2023 16:43:49 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0013.hostedemail.com [216.40.44.13]) by kanga.kvack.org (Postfix) with ESMTP id 1C4C18E000B for ; Mon, 10 Jul 2023 16:43:49 -0400 (EDT) Received: from smtpin08.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay06.hostedemail.com (Postfix) with ESMTP id EAD37AFAB9 for ; Mon, 10 Jul 2023 20:43:48 +0000 (UTC) X-FDA: 80996878536.08.02B7DFD Received: from casper.infradead.org (casper.infradead.org [90.155.50.34]) by imf03.hostedemail.com (Postfix) with ESMTP id 3778C2000B for ; Mon, 10 Jul 2023 20:43:46 +0000 (UTC) Authentication-Results: imf03.hostedemail.com; dkim=pass header.d=infradead.org header.s=casper.20170209 header.b=QUlAJhWR; dmarc=none; spf=none (imf03.hostedemail.com: domain of willy@infradead.org has no SPF policy when checking 90.155.50.34) smtp.mailfrom=willy@infradead.org ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1689021827; h=from:from:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references:dkim-signature; bh=paPNbsDhrgFpFK66NfUXWHVPB3cHJyjAQhVhGRR5N+U=; b=Py10z7d/CnUkUVuXTcyAfEJmexmnaGGz9xmCr4WncoWhOQwZbAMdvXCMj4tqGwtUBwl7Al Hf3w2VYLAGtk1fleKAm3vXVK5NrRgVxgsQXu42/GHbN1dajGmEmk4ZA9dMFnLRbjJbSzRH QE2LkASp0/akHp3wo0F/e54RujWu3WQ= ARC-Authentication-Results: i=1; imf03.hostedemail.com; dkim=pass header.d=infradead.org header.s=casper.20170209 header.b=QUlAJhWR; dmarc=none; spf=none (imf03.hostedemail.com: domain of willy@infradead.org has no SPF policy when checking 90.155.50.34) smtp.mailfrom=willy@infradead.org ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1689021827; a=rsa-sha256; cv=none; b=fG+eh3R2QL0cQ1wSqo0ArEYw54Xj4+LnQBuDydWKuiwKxgfyeuj+pYEnAt3lvu0Lq19m2C zs8PeGW3c2E04zv7vQyclWCBRPVsJcYN6YxooYPDoAKxQfXdo8uAMEeI7exo5MU1wxWiXg ePybDz9JAUiJa9ZDoeyUln6ay+KRwzA= 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-Rspamd-Server: rspam09 X-Rspamd-Queue-Id: 3778C2000B X-Stat-Signature: a71edyam8rfou99u1mq88jokkygc7s6a X-Rspam-User: X-HE-Tag: 1689021826-923627 X-HE-Meta: U2FsdGVkX1+EBLupb+5jgMqRFiodGeeUZKAXs7Zs5jYYBxpZe6lGAaxwIbZmieacrGADOv7Lw3muDfZDnEi9s2EY5vMuRKYZlnXG+oRvZBjsiCqB/i8lB5tvefoiDMZ2Eua5kjb4sT6JXssoXeqfxqWVQW1ZgqRVIHqg1dvnDev2pLXAaRqC9SOpvcv2NYKMal8GTTjrFs0f+zA5KHfPcV9M8PnXDCz3tskahpvJl+2wYrbKQ6ra+UXPkoOLtMM68CmQwfbFmowjN98AXiFxqijk1tVjxeH4eM6Ni1/roQ2RJLwmxkFJ3e23o2x5iXbGcCBGRTM6v/m4YuYiMIIcZihVP96hPY4jFnW2Jk/PnDtBZUNP8uJFlQffQGdHXPniX/qSYL/+weeQtdXfgw7Kuo2dPCTvel6ldrSf0GZSqNYVMbnFqBA3cWrIG2cQGq49fcQAOaRFM3xLNSRbor4Efna/JDjPMqkAnLem66xHMWsOo0CkK66DdJgOV8P/5lun30+N+kyKfyQ9rBlI2/fnkRXEaShkJ//5Ju56WuT432yRZUTUDJv5dAq2CVsH4ZRNxTZkdNxh0HGGgvf6ekqFOUOBr4I2yYmWRWS6wzxN9zWaczgBD6pxmnCpQ3eAk0jIhyadzuQdhIlScE7B7EE0ENfIqdt/8j4LLZdtEaTV3TJCbyel2NJ/wWfVwUpYCWzcbED5JOTc2dFchEvJ/llwmQYNlBVRSjitJYeXDwbCi8nbtu9e2+aThHcpH6PDRFZgBiFO0m2bNHETIRYiDBgAJME6XaHOk9EMH7T0T9xyXC9p6EvJvZX2WrBEh7/VTuv5G+hIIb/L+5YMChwVYrFrY9EbV33gpWXEq79H3+hiRL/WEwjFgHpekkp42IIxjVDccKYU+zO3uupp9NChZY0UtWRYU4gOOXHyo1uc06WfQXfYWTsQnKHqoXxJpH75HqfF3QNyuZXuZwliZyOMDYf nf9rH8+H YgAPAHOpzQo3VBjOBESxXibx5C2WPgRg6xhQTVLpN65q/p0SAFTylmaM1YpMJOjiT4vaitBeC65WPXU4KZOVY0SjZxGqB3RIBPJ2EZzd3gvYEWj3wAmAca31YJPIk8VrQL9yPRm+ZqtALLsfO67NaYHJOc6slErTRjL5mJaVrk7dlfDA61/sDhNYvuUHIUDupUCaEqEIyEPFPaqVZkWDQlosHddoP/laxbIbTVhHOcDKJIFYad8ufYRTaQxEtuaV3i82/SO2i7NfNy+mvXK/Oo5gCspscYXTBdS9R X-Bogosity: Ham, tests=bogofilter, spamicity=0.000000, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: 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)