From patchwork Wed Aug 2 15:14:01 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Matthew Wilcox X-Patchwork-Id: 13338352 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 88ADCC04A6A for ; Wed, 2 Aug 2023 15:14:50 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id E25AC28019F; Wed, 2 Aug 2023 11:14:18 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id DABD32801A1; Wed, 2 Aug 2023 11:14:18 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id B136028019F; Wed, 2 Aug 2023 11:14:18 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0011.hostedemail.com [216.40.44.11]) by kanga.kvack.org (Postfix) with ESMTP id 9BF6A28019B for ; Wed, 2 Aug 2023 11:14:18 -0400 (EDT) Received: from smtpin04.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay09.hostedemail.com (Postfix) with ESMTP id 717F880ECF for ; Wed, 2 Aug 2023 15:14:18 +0000 (UTC) X-FDA: 81079510596.04.F70B70C Received: from casper.infradead.org (casper.infradead.org [90.155.50.34]) by imf10.hostedemail.com (Postfix) with ESMTP id C5B39C0022 for ; Wed, 2 Aug 2023 15:14:16 +0000 (UTC) Authentication-Results: imf10.hostedemail.com; dkim=pass header.d=infradead.org header.s=casper.20170209 header.b=StoT9OIc; spf=none (imf10.hostedemail.com: domain of willy@infradead.org has no SPF policy when checking 90.155.50.34) smtp.mailfrom=willy@infradead.org; dmarc=none ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1690989256; 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=Lo+Ghw1793UV9pKFBxkz2iQJ13EHx7xbrSdwvVIFCO0=; b=M7pcoo/vCRbcTATtbBWmA/t6bG2VbOglvDCpZ7fSaeLdJ/XXBf8Ok7KzpJOc0ehLPdohbt C9/4/u1/tH9k3QOpnzKQ9dfLJgSV9HA1s6/PgP4vBEYGV9Nt05OXmPIHF5ZY8VQTauyRdW IT5VSpLZiQMmjuEiUBqnu6EozpPCbqo= ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1690989256; a=rsa-sha256; cv=none; b=hbAJnbyjgDDinFvYVrQiLawq8u4F1VNbIcAUjJ7553y6rcNrvllM8JJBfVzSN24XnWl5u7 G6MEJW6jDhGsZ9CtbIRZI9FXrClw8yMqsPidMbAJ0Mohpp61qetsoScpEO6kVcK/FIcp5j 9J6211BOymScPA4T3jby8Wot9TqbIA4= ARC-Authentication-Results: i=1; imf10.hostedemail.com; dkim=pass header.d=infradead.org header.s=casper.20170209 header.b=StoT9OIc; spf=none (imf10.hostedemail.com: domain of willy@infradead.org has no SPF policy when checking 90.155.50.34) smtp.mailfrom=willy@infradead.org; dmarc=none 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 X-Rspamd-Queue-Id: C5B39C0022 X-Rspam-User: X-Stat-Signature: qar89mcyxry49n3mato1o9gfs3jy4jhc X-Rspamd-Server: rspam03 X-HE-Tag: 1690989256-165819 X-HE-Meta: U2FsdGVkX1+Qs3hqQ+U1gl/uV6c9PZLdG6Bq3H8XTqEFfiOXQPzFmb3YM2g89BCT5VIOaj29sdedlV6rdJZ5kfRRM22NLffoJ+ChEK1TILyt44wkg+6y723e8/HOGD5jAmYjApRHUV0xDuvSLdyCsXhlnUfuHy4AiKDhujVDmIQmwVYVWjIx1YZLk/XjVp0WZrPLk8x4OV/IMrPSfYsy/4DXhM3ETN3G/ZHVRc90D/gPWoZoju5hjqcSNfhHZfmKX4KcNlePJpa4sDfTOCKV8LMxT26hoj64i/3WmOpO+CeH0T+cSByyvBvz6F2yVufFFIk3G0IDmdWRqSXp38HtUV7nfMaHinD3SbJa+DUdHFgQNS8GEDAzbskVHtlik4absnWUVd4ZAirzVKLuE3uAbxgsn6WRjkwttxSutmA4xXTAZfXkV2sfh2QtHvcMaUV04WvjVqmFftGUtsOhVPTDjcIoOX+Nw80mHZlzGLAJ6MrWPeDALqg7cKa/84v99/gLLPXC4FarT1aewmpC20GSRdiP3oQHNypVGGGCWUDKB5kWnEo0fJMZMFjiqkArefr/xmtq3CqBpWGxfiWTvtuNvPaHsBZ6Y0MZHwq0XWgFOruF2svhZ7/QhaJ66rGjHcr+oNYkeLscAfLOsbo2u+7yCPxOFG8Ramz3FRyXIyNKU1JeDjFEgVbEJ9qafuww9PBhi04by3oRktWXNBU68lVlysqvKpLFgie7EDOrBt7RgUVye6bg9EvELsetCBwk3gG5X+H/jt/K4QBoIlNz4gAggtnvfszP0n53Ij9CLbfAItEHpwL27S50bm7Ec6oiA4ohydbBfqHex7AgSi91cN9PpVcXjDkbeUb1pww7gufNhXOlUpS6BLG+ReHw/3ycR7SnnAnqnWf4KBZNFaIUDcE0VJnG7eP0PoH7vGCnYsWN4V0/zXyri6zvZtHy2UsR06vyJcwwoOskX1GLJXjoYE+ h/srwu+f qYvIWlggojMIpBfSkxklUZ257ld2PT8xzYqRpV0MdnH/8S94YCHNcaQLm0DzN3ZBFtywR6fE6YNWtGT2SO5/Q0UyeAwLT8DEKuOfe2xSXmc3LgA1hIXQb+95Qz+U/74Ri7F83ckQ687hAelT2TACAmOJk0BT6SuggFF8F69QNNIc3HN7b+HdGHC5Rbo5w0SLatqTkd64FGiUESVhaPVrF+vPIlGQbWwG6SqdcEjW32ULbDkXrjc4/ICvm/HtO0EmIDLVz8dtGpI1JZMu9bpR0ZAk4CqaikybUAEBc 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 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)