From patchwork Sun Jun 17 01:59:58 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Matthew Wilcox X-Patchwork-Id: 10468185 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id EDE56600CC for ; Sun, 17 Jun 2018 02:01:12 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id DD90828BC1 for ; Sun, 17 Jun 2018 02:01:12 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id D22F328BDB; Sun, 17 Jun 2018 02:01:12 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-2.8 required=2.0 tests=BAYES_00,DKIM_SIGNED, MAILING_LIST_MULTI,RCVD_IN_DNSWL_NONE,T_DKIM_INVALID autolearn=ham version=3.3.1 Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 546AE28BC1 for ; Sun, 17 Jun 2018 02:01:12 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id C5CDE6B0010; Sat, 16 Jun 2018 22:01:01 -0400 (EDT) Delivered-To: linux-mm-outgoing@kvack.org Received: by kanga.kvack.org (Postfix, from userid 40) id BB5BB6B0008; Sat, 16 Jun 2018 22:01:01 -0400 (EDT) X-Original-To: int-list-linux-mm@kvack.org X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 63DEF6B000A; Sat, 16 Jun 2018 22:01:01 -0400 (EDT) X-Original-To: linux-mm@kvack.org X-Delivered-To: linux-mm@kvack.org Received: from mail-pf0-f197.google.com (mail-pf0-f197.google.com [209.85.192.197]) by kanga.kvack.org (Postfix) with ESMTP id D38A56B000D for ; Sat, 16 Jun 2018 22:01:00 -0400 (EDT) Received: by mail-pf0-f197.google.com with SMTP id c187-v6so6677477pfa.20 for ; Sat, 16 Jun 2018 19:01:00 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:dkim-signature:from:to:cc:subject:date :message-id:in-reply-to:references; bh=W0ynj2cOXWAnsurcEVHQi3Lm3HZqNiOYUwJR3JyoSgg=; b=IVmlnDz55fgyndiHu4PgI5ps/GmA9gVYmdOWOsyPFWRJmQUO8Mm0mYqJtVVWb6kVfK 03DItr3XpRTMbfiZA2wNYiq2pQ84CHewr/6vCbiZrvEEMeOFB+jqwwJOF1+odL8kAVWS LG+jwrfD0vu0LM1WLG+n6k9p8z4/5A5+CtVca2ZwV0+CPD55yRyjZZElBt3+bVV7HS0e Mnx+5RkZtwdVSwdJEvDihQfhYfSf/p2Nhb0xruvag4unZuGf2k8WIzplXfSd3hb7a41v yh2OvFRCinSqy//BIZMQkLmIHykFMMg2OkL0yx4XXvq2aI/q1LHQu67y94xV3kXIcBwT iBCA== X-Gm-Message-State: APt69E1TtmfUcniTY/EReQuzD/LHxzbMUg5CfP2Pg5vCE6wt9y0ALbFc vC+3zn6ToO9ENeyAhHohbk4b1IfvxuzDGbkBrL6TedgUXIN+H77OYtu+SKKJ4buDZvcDX+VUNC6 RivPaHDfBld4I7OmmhAKaNEmfwqsLUCx3u+btJ4a/ly3KtnlZpZZSwa5efTmtNHQSGA== X-Received: by 2002:a17:902:8206:: with SMTP id x6-v6mr8279255pln.220.1529200860540; Sat, 16 Jun 2018 19:01:00 -0700 (PDT) X-Google-Smtp-Source: ADUXVKKSR0RWfZU58tZW/rqCG7VdW/pPHsaAbupEua8ifb6mNavXqdLMc/79YZP7sQ1OV9/soAan X-Received: by 2002:a17:902:8206:: with SMTP id x6-v6mr8279198pln.220.1529200859264; Sat, 16 Jun 2018 19:00:59 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1529200859; cv=none; d=google.com; s=arc-20160816; b=Vny/VoDRjHNZJI+g1aL/1tNvk/lUTF4KlRMeMMRR3/tWm9P+UZsbyLjLthJKqLVFvb dogVakYAf4DMAIwIvD8x8RPJVZgEcW7JcBq4Lehk9tNAkWiZ7IM5kDej4rdyk2QNziIo UoJLGUgcYNjtR0rQs2E2lxy8Ys4obU/RaJdrofKKy/YXgaMz374IcWQ1ausLm+kQuicX fKfORGgB3L31kibZoT15QrKEpz4LY/HkprZn+0VeYwqjIQXXZjJTeMQvIOQ4eYxWl/Lv 8ID509dkB7D3MJVzrWpVVqnwtwshF7h3bkZoOrdangIomzfxHNU/b9dBXfsYVD08XTvg RaHA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature:arc-authentication-results; bh=W0ynj2cOXWAnsurcEVHQi3Lm3HZqNiOYUwJR3JyoSgg=; b=s94gDT5aww4BeV7hv/V3nLqj/x4W7tvZiHA3ratfQ35/dlOfrdiMrlyUS3St9UQY99 2IfwKu0wyLFr61dq+WQz/vY9Igd/SAU2vgUj1WoFnUJw/sGJC8Dx5SYViIfzeJRaLeVR bHzcpZasU6r516LH+zerwzmwGRnWwLIthuMt2Fs/0VEk1VrPL24OoHOyCsbLd2B6yUmp vuBao8aX1RIzwnb1Y94gQ0g8rTRGvLS2u1XAWJIFJKH6/yy41c8g4GSWjohRk47otcgn IEDmcaDkGHNJ9rS7f8et6FeNhodcekD8AgNGwhOm2LrCoBo1eou9UcwG4/PVywsEHHJa aYtw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@infradead.org header.s=bombadil.20170209 header.b=mPOhuSdO; spf=pass (google.com: best guess record for domain of willy@infradead.org designates 2607:7c80:54:e::133 as permitted sender) smtp.mailfrom=willy@infradead.org Received: from bombadil.infradead.org (bombadil.infradead.org. [2607:7c80:54:e::133]) by mx.google.com with ESMTPS id z3-v6si9464111pgn.365.2018.06.16.19.00.59 for (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Sat, 16 Jun 2018 19:00:59 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of willy@infradead.org designates 2607:7c80:54:e::133 as permitted sender) client-ip=2607:7c80:54:e::133; Authentication-Results: mx.google.com; dkim=pass header.i=@infradead.org header.s=bombadil.20170209 header.b=mPOhuSdO; spf=pass (google.com: best guess record for domain of willy@infradead.org designates 2607:7c80:54:e::133 as permitted sender) smtp.mailfrom=willy@infradead.org DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=bombadil.20170209; h=References:In-Reply-To:Message-Id: Date:Subject:Cc:To:From:Sender:Reply-To:MIME-Version:Content-Type: Content-Transfer-Encoding:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Id: List-Help:List-Unsubscribe:List-Subscribe:List-Post:List-Owner:List-Archive; bh=W0ynj2cOXWAnsurcEVHQi3Lm3HZqNiOYUwJR3JyoSgg=; b=mPOhuSdOlghTW4EZ48RYSLVFr L1QHIV0mnAWcK/e4GNgt+vfH4MD8ZwX57Zk8sYt7QIofkZsQw7WE+sBNvkXAaqXXbV22pD8mK8nPu 4vs5fcc3ipwxEppipseSwGBknmfUkkqaZpxEF8b1g4SIm8Wyj7ERKDaliIVW2mmeo5waimsCJdIpa KKlueWEsIgZ9GPMURo0FcHSPLN5OGpXYXRHJoJmIDNvZy3+gaT77ozcPzkHhIePHjZn9fpcX8A02p QrdnLPfet3rYarQuuNPajHC6ZO/0z2WeJaEejxDA8Do5QKqwvFNVn+qYyGz6DSBd7CTS8XjisGORh f1f6RlcFA==; Received: from willy by bombadil.infradead.org with local (Exim 4.90_1 #2 (Red Hat Linux)) id 1fUMzy-0001Gu-9X; Sun, 17 Jun 2018 02:00:58 +0000 From: Matthew Wilcox To: linux-mm@kvack.org, linux-fsdevel@vger.kernel.org, linux-kernel@vger.kernel.org Cc: Matthew Wilcox , Jan Kara , Jeff Layton , Lukas Czerner , Ross Zwisler , Christoph Hellwig , Goldwyn Rodrigues , Nicholas Piggin , Ryusuke Konishi , linux-nilfs@vger.kernel.org, Jaegeuk Kim , Chao Yu , linux-f2fs-devel@lists.sourceforge.net Subject: [PATCH v14 20/74] page cache: Rearrange address_space Date: Sat, 16 Jun 2018 18:59:58 -0700 Message-Id: <20180617020052.4759-21-willy@infradead.org> X-Mailer: git-send-email 2.14.3 In-Reply-To: <20180617020052.4759-1-willy@infradead.org> References: <20180617020052.4759-1-willy@infradead.org> 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: X-Virus-Scanned: ClamAV using ClamSMTP Change i_pages from a radix_tree_root to an xarray, convert the documentation into kernel-doc format and change the order of the elements to pack them better on 64-bit systems. Signed-off-by: Matthew Wilcox --- include/linux/fs.h | 46 +++++++++++++++++++++++++++++++--------------- 1 file changed, 31 insertions(+), 15 deletions(-) diff --git a/include/linux/fs.h b/include/linux/fs.h index 8c1c56584e08..f1716ce5ff6f 100644 --- a/include/linux/fs.h +++ b/include/linux/fs.h @@ -396,24 +396,40 @@ int pagecache_write_end(struct file *, struct address_space *mapping, loff_t pos, unsigned len, unsigned copied, struct page *page, void *fsdata); +/** + * struct address_space - Contents of a cacheable, mappable object. + * @host: Owner, either the inode or the block_device. + * @i_pages: Cached pages. + * @gfp_mask: Memory allocation flags to use for allocating pages. + * @i_mmap_writable: Number of VM_SHARED mappings. + * @i_mmap: Tree of private and shared mappings. + * @i_mmap_rwsem: Protects @i_mmap and @i_mmap_writable. + * @nrpages: Number of page entries, protected by the i_pages lock. + * @nrexceptional: Shadow or DAX entries, protected by the i_pages lock. + * @writeback_index: Writeback starts here. + * @a_ops: Methods. + * @flags: Error bits and flags (AS_*). + * @wb_err: The most recent error which has occurred. + * @private_lock: For use by the owner of the address_space. + * @private_list: For use by the owner of the address_space. + * @private_data: For use by the owner of the address_space. + */ struct address_space { - struct inode *host; /* owner: inode, block_device */ - struct radix_tree_root i_pages; /* cached pages */ - atomic_t i_mmap_writable;/* count VM_SHARED mappings */ - struct rb_root_cached i_mmap; /* tree of private and shared mappings */ - struct rw_semaphore i_mmap_rwsem; /* protect tree, count, list */ - /* Protected by the i_pages lock */ - unsigned long nrpages; /* number of total pages */ - /* number of shadow or DAX exceptional entries */ + struct inode *host; + struct xarray i_pages; + gfp_t gfp_mask; + atomic_t i_mmap_writable; + struct rb_root_cached i_mmap; + struct rw_semaphore i_mmap_rwsem; + unsigned long nrpages; unsigned long nrexceptional; - pgoff_t writeback_index;/* writeback starts here */ - const struct address_space_operations *a_ops; /* methods */ - unsigned long flags; /* error bits */ - spinlock_t private_lock; /* for use by the address_space */ - gfp_t gfp_mask; /* implicit gfp mask for allocations */ - struct list_head private_list; /* for use by the address_space */ - void *private_data; /* ditto */ + pgoff_t writeback_index; + const struct address_space_operations *a_ops; + unsigned long flags; errseq_t wb_err; + spinlock_t private_lock; + struct list_head private_list; + void *private_data; } __attribute__((aligned(sizeof(long)))) __randomize_layout; /* * On most architectures that alignment is already the case; but