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=-9.6 required=3.0 tests=DKIM_INVALID,DKIM_SIGNED, HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_PATCH,MAILING_LIST_MULTI,SIGNED_OFF_BY, 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 5F22CC433DF for ; Fri, 15 May 2020 13:17:07 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id 22C7A20709 for ; Fri, 15 May 2020 13:17:07 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=fail reason="signature verification failed" (2048-bit key) header.d=infradead.org header.i=@infradead.org header.b="nqanRsm8" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 22C7A20709 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 0CEC68E0005; Fri, 15 May 2020 09:17:03 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id D25B180054; Fri, 15 May 2020 09:17:02 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id BD3F68E0005; Fri, 15 May 2020 09:17:02 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0061.hostedemail.com [216.40.44.61]) by kanga.kvack.org (Postfix) with ESMTP id 848BB90000E for ; Fri, 15 May 2020 09:17:02 -0400 (EDT) Received: from smtpin08.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay01.hostedemail.com (Postfix) with ESMTP id 3DFDE180ACF75 for ; Fri, 15 May 2020 13:17:02 +0000 (UTC) X-FDA: 76819003884.08.sky72_5a83a31b2e556 X-HE-Tag: sky72_5a83a31b2e556 X-Filterd-Recvd-Size: 4295 Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) by imf43.hostedemail.com (Postfix) with ESMTP for ; Fri, 15 May 2020 13:17:01 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=bombadil.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=FkHxGbykMgCdP+hiVpFj6lwTAQyIJGGRkvdY09TfM9I=; b=nqanRsm8CbBELPCnlwiLCacS9O WlkB/ez4UH2qiVdY+HY/5eHi8hgD0buGdG6FN+0HGwkTzH+L3L4jVlUyOcdRWAbX/aPoaDyW87mMb Qiu4N5CgmlTLWxr9ho1n3jW8OhJ2uxlSURzLqYEkdowQoigJAHgc4EhBbBX0ki0LWRvpFh8NczHeE Jf70UnBjk+D1F1NFAaki8tk4IjkMF8OywF70RvX8iLU8bjg6tIZGMVMFtq++db7O1nc0xdO23bIgO sOEsn1A2GP7cYwh4zs3QHOkjAwn2Cx3lY79IRX8WQDitMgukAOa7LOGqfyNChQh5IMDbcnbh7AjTi caBlNSJA==; Received: from willy by bombadil.infradead.org with local (Exim 4.92.3 #3 (Red Hat Linux)) id 1jZaCy-0005YF-Rp; Fri, 15 May 2020 13:17:00 +0000 From: Matthew Wilcox To: linux-fsdevel@vger.kernel.org Cc: "Matthew Wilcox (Oracle)" , linux-mm@kvack.org, linux-kernel@vger.kernel.org Subject: [PATCH v4 08/36] fs: Do not update nr_thps for large page mappings Date: Fri, 15 May 2020 06:16:28 -0700 Message-Id: <20200515131656.12890-9-willy@infradead.org> X-Mailer: git-send-email 2.21.1 In-Reply-To: <20200515131656.12890-1-willy@infradead.org> References: <20200515131656.12890-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: From: "Matthew Wilcox (Oracle)" The nr_thps counter is to support large pages in the page cache when the filesystem does not support writing large pages. Eventually it will be removed, but we should still support filesystems which do not understand large pages yet. Move the nr_thp manipulation functions to filemap.h since they're page-cache specific. Signed-off-by: Matthew Wilcox (Oracle) --- include/linux/fs.h | 27 --------------------------- include/linux/pagemap.h | 29 +++++++++++++++++++++++++++++ 2 files changed, 29 insertions(+), 27 deletions(-) diff --git a/include/linux/fs.h b/include/linux/fs.h index 777783c8760b..1ab65898bd96 100644 --- a/include/linux/fs.h +++ b/include/linux/fs.h @@ -2830,33 +2830,6 @@ static inline errseq_t filemap_sample_wb_err(struc= t address_space *mapping) return errseq_sample(&mapping->wb_err); } =20 -static inline int filemap_nr_thps(struct address_space *mapping) -{ -#ifdef CONFIG_READ_ONLY_THP_FOR_FS - return atomic_read(&mapping->nr_thps); -#else - return 0; -#endif -} - -static inline void filemap_nr_thps_inc(struct address_space *mapping) -{ -#ifdef CONFIG_READ_ONLY_THP_FOR_FS - atomic_inc(&mapping->nr_thps); -#else - WARN_ON_ONCE(1); -#endif -} - -static inline void filemap_nr_thps_dec(struct address_space *mapping) -{ -#ifdef CONFIG_READ_ONLY_THP_FOR_FS - atomic_dec(&mapping->nr_thps); -#else - WARN_ON_ONCE(1); -#endif -} - extern int vfs_fsync_range(struct file *file, loff_t start, loff_t end, int datasync); extern int vfs_fsync(struct file *file, int datasync); diff --git a/include/linux/pagemap.h b/include/linux/pagemap.h index c6db74b5e62f..cacd5a30cb9d 100644 --- a/include/linux/pagemap.h +++ b/include/linux/pagemap.h @@ -121,6 +121,35 @@ static inline bool mapping_large_pages(struct addres= s_space *mapping) return mapping->host->i_sb->s_type->fs_flags & FS_LARGE_PAGES; } =20 +static inline int filemap_nr_thps(struct address_space *mapping) +{ +#ifdef CONFIG_READ_ONLY_THP_FOR_FS + return atomic_read(&mapping->nr_thps); +#else + return 0; +#endif +} + +static inline void filemap_nr_thps_inc(struct address_space *mapping) +{ +#ifdef CONFIG_READ_ONLY_THP_FOR_FS + if (!mapping_large_pages(mapping)) + atomic_inc(&mapping->nr_thps); +#else + WARN_ON_ONCE(1); +#endif +} + +static inline void filemap_nr_thps_dec(struct address_space *mapping) +{ +#ifdef CONFIG_READ_ONLY_THP_FOR_FS + if (!mapping_large_pages(mapping)) + atomic_dec(&mapping->nr_thps); +#else + WARN_ON_ONCE(1); +#endif +} + void release_pages(struct page **pages, int nr); =20 /* --=20 2.26.2