From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-16.6 required=3.0 tests=BAYES_00,DKIM_INVALID, DKIM_SIGNED,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER,INCLUDES_PATCH, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED,USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 1AFA8C4361B for ; Wed, 16 Dec 2020 18:46:58 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id 9EA62233FE for ; Wed, 16 Dec 2020 18:46:57 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 9EA62233FE Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=infradead.org Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=owner-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix) id 275848D0003; Wed, 16 Dec 2020 13:46:57 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id 24D008D0002; Wed, 16 Dec 2020 13:46:57 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 0A1408D0003; Wed, 16 Dec 2020 13:46:57 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0116.hostedemail.com [216.40.44.116]) by kanga.kvack.org (Postfix) with ESMTP id E8E2C8D0002 for ; Wed, 16 Dec 2020 13:46:56 -0500 (EST) Received: from smtpin12.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay02.hostedemail.com (Postfix) with ESMTP id A2C3C362E for ; Wed, 16 Dec 2020 18:46:56 +0000 (UTC) X-FDA: 77600027232.12.flesh51_28130a22742e Received: from filter.hostedemail.com (10.5.16.251.rfc1918.com [10.5.16.251]) by smtpin12.hostedemail.com (Postfix) with ESMTP id 75ABD1800E613 for ; Wed, 16 Dec 2020 18:46:56 +0000 (UTC) X-HE-Tag: flesh51_28130a22742e X-Filterd-Recvd-Size: 3678 Received: from casper.infradead.org (casper.infradead.org [90.155.50.34]) by imf41.hostedemail.com (Postfix) with ESMTP for ; Wed, 16 Dec 2020 18:46:55 +0000 (UTC) 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=pdx6lYxeD1EW2wljUgpbb5DjEhz77Vz6Uwdtyq++/2E=; b=WLRTNy4RHQwlqEvtD8WvIZwTXE ai5BeoUNEB9KiNCBTDffKOTHcFrP9LGi47yySqEB8aXno4JthM75NCoOkbSUlaI5+pH4PaNakMui3 UHuTD4hQZ0ym4V5HMQKBcrXdGuIQk+8JKMN4rQ35ItiWy6VFm3lvKZHAnDBcjjOvQwo98BFhJcg/E bTewMZTFdQr2T/klVLLvo8axWRXr74xuWvo7DRkBF5vNyQ5mBFeSI1vZtZypJwAEBqhQSM/9umP1Z SfqfWygyz9YyAcxdBVIoW4+mZoVTlZBSlr4AasY4+eqVt8AmOQgInt/uSnHEj5Asn9VIOwhpTpCsE W3chTQig==; Received: from willy by casper.infradead.org with local (Exim 4.92.3 #3 (Red Hat Linux)) id 1kpbSi-000790-Te; Wed, 16 Dec 2020 18:23:44 +0000 From: "Matthew Wilcox (Oracle)" To: linux-fsdevel@vger.kernel.org, linux-mm@kvack.org Cc: "Matthew Wilcox (Oracle)" , linux-kernel@vger.kernel.org Subject: [PATCH 23/25] mm: Add flush_dcache_folio Date: Wed, 16 Dec 2020 18:23:33 +0000 Message-Id: <20201216182335.27227-24-willy@infradead.org> X-Mailer: git-send-email 2.21.3 In-Reply-To: <20201216182335.27227-1-willy@infradead.org> References: <20201216182335.27227-1-willy@infradead.org> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable 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: This is a default implementation which calls flush_dcache_page() on each page in the folio. If architectures can do better, they should implement their own version of it. Signed-off-by: Matthew Wilcox (Oracle) --- Documentation/core-api/cachetlb.rst | 6 ++++++ include/asm-generic/cacheflush.h | 13 +++++++++++++ 2 files changed, 19 insertions(+) diff --git a/Documentation/core-api/cachetlb.rst b/Documentation/core-api= /cachetlb.rst index a1582cc79f0f..484cf31fcded 100644 --- a/Documentation/core-api/cachetlb.rst +++ b/Documentation/core-api/cachetlb.rst @@ -325,6 +325,12 @@ maps this page at its virtual address. dirty. Again, see sparc64 for examples of how to deal with this. =20 + ``void flush_dcache_folio(struct folio *folio)`` + This function is called under the same circumstances as + flush_dcache_page(). It allows the architecture to + optimise for flushing the entire folio of pages instead + of flushing one page at a time. + ``void copy_to_user_page(struct vm_area_struct *vma, struct page *page= , unsigned long user_vaddr, void *dst, void *src, int len)`` ``void copy_from_user_page(struct vm_area_struct *vma, struct page *pa= ge, diff --git a/include/asm-generic/cacheflush.h b/include/asm-generic/cache= flush.h index 4a674db4e1fa..5537ea24333d 100644 --- a/include/asm-generic/cacheflush.h +++ b/include/asm-generic/cacheflush.h @@ -49,9 +49,22 @@ static inline void flush_cache_page(struct vm_area_str= uct *vma, static inline void flush_dcache_page(struct page *page) { } + +static inline void flush_dcache_folio(struct folio *folio) { } #define ARCH_IMPLEMENTS_FLUSH_DCACHE_PAGE 0 +#define ARCH_IMPLEMENTS_FLUSH_DCACHE_FOLIO #endif =20 +#ifndef ARCH_IMPLEMENTS_FLUSH_DCACHE_FOLIO +static inline void flush_dcache_folio(struct folio *folio) +{ + unsigned int n =3D folio_nr_pages(folio); + + do { + flush_dcache_page(&folio->page[--n]); + } while (n); +} +#endif =20 #ifndef flush_dcache_mmap_lock static inline void flush_dcache_mmap_lock(struct address_space *mapping) --=20 2.29.2