From patchwork Fri May 4 18:33:07 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Matthew Wilcox X-Patchwork-Id: 10381343 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 C7F6160541 for ; Fri, 4 May 2018 18:59:04 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id B68C129596 for ; Fri, 4 May 2018 18:59:04 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id A931429597; Fri, 4 May 2018 18:59:04 +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 E323F2954C for ; Fri, 4 May 2018 18:59:03 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 082676B0277; Fri, 4 May 2018 14:33:37 -0400 (EDT) Delivered-To: linux-mm-outgoing@kvack.org Received: by kanga.kvack.org (Postfix, from userid 40) id 05A186B0279; Fri, 4 May 2018 14:33:37 -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 EB5B56B0278; Fri, 4 May 2018 14:33:36 -0400 (EDT) X-Original-To: linux-mm@kvack.org X-Delivered-To: linux-mm@kvack.org Received: from mail-pg0-f72.google.com (mail-pg0-f72.google.com [74.125.83.72]) by kanga.kvack.org (Postfix) with ESMTP id A96596B0275 for ; Fri, 4 May 2018 14:33:36 -0400 (EDT) Received: by mail-pg0-f72.google.com with SMTP id t74-v6so6796026pgc.14 for ; Fri, 04 May 2018 11:33:36 -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=/BDKIHN8jdX724Mg9Q26nBY8EGhAQqCzvEkBVDhP1gU=; b=siC84G854kz16z/8+7EVZe6Q9uy0aMC1t0o7yZQD/hfobVniH4QnkPkrfH+0A5Q2yc bnQdXQzaQuJAtj16lM2mLMNzdKtuQStSgGJgNONAtx/NLlejJgQCe0HMLkuep2/8tAVg WCfjzYkwbTFwuL9DUewFIpNiqgPZ4TTaq+imDsiLqsWPyPDXPCHZgSHWmuxpytxnJbj2 vYxxapYOARpc65CCUTWQE2j0UUazRER+oGQM59k/28Io5G3iuRgtA9Hkh56f4XxHfmuV CkrEAV0l9E3OnvZo+H0AVA0l91kq7tzuYszHwXORsp9NtbqtLZKfGtkKDg6C9mBQDdlC G02Q== X-Gm-Message-State: ALQs6tB6gViNEgdJ0yI4zyqM6J89Qq9ZzlTVpjqU99doGM/CoRkzV4Y+ tk/sPhoYt53DPP4gLlMcp3gNaVAQ0FRNyR44F0CEQW8vTFs2Ddjb+gvVMhxk/bVwCCOgFfqKqGY 0Gv6ltB1nxTp7qeBrgRLtf/NPkwcHRpiQ2AbKzZV9xB4ZS6Udj/7YO5Pp4tJMc+lKfA== X-Received: by 2002:a17:902:bb93:: with SMTP id m19-v6mr9172018pls.74.1525458816403; Fri, 04 May 2018 11:33:36 -0700 (PDT) X-Google-Smtp-Source: AB8JxZrx9tg1P6DTzWooq5/Aq9yA18EUgxqNERbjW7b7KpYCcOVQUl/xnbqBq3lZEUs96ETeCMZF X-Received: by 2002:a17:902:bb93:: with SMTP id m19-v6mr9171507pls.74.1525458803049; Fri, 04 May 2018 11:33:23 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1525458803; cv=none; d=google.com; s=arc-20160816; b=HHOOXl/ufqBph70mt+ryURoiXhKSmluLiZerPzX4ZUFX3Cc3ugsnqaD+IhSJxd7vDK d0vhPSjoBuE26X20CGU4WN/ZDwLGiotoP9G15I5P8Wt6eiG39PY7GnsSUrAsn0L6owds DflRYk+YHpz7Rn7yGTJqp8NO1gZO+XobV1HzaH4Q6ERKym/8rlUWPXZyumag0ZcyvfhC vC6tNzeCvmxZ1X+Q9PuhBaOktLgDn3NRiVqc0usZuASyIjZI3Q2haQC5XSK4Vv2L3YYq SSOTsXzqF67FzbffO1rDNBo98o51ze9fWqfGahR1ict/gsgXlhiWyVHA7+rxDHiRQDwR Z4oA== 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=/BDKIHN8jdX724Mg9Q26nBY8EGhAQqCzvEkBVDhP1gU=; b=CuSqOO7JZ4kEsyBDFi6IEGNsEg+F17sHzmncmAU146Fik6k/iXnBiD9O/ohDymv3aS uyx8m6EMK6KQUYSNJSGyDuiuFfpmeQZ4sDAyJuGqKeNwdIEtGZaQsrW12ROzui3Jf0G5 ooUnS0jQ2oyn1lZDKrQDeq1afGo0xXFenDMgvUkOv3dPOY/dpTzCRSjtD/+DBBceHbtw vZ/scSsLRtGUacrnWgOT5wwawKnlrkAK/GNBZPJjgbqq93gr5I0dDPyrRRQ2VNDjwMH7 Tw5L9aIzZiRY2cIITztAE3aqtI6mUNgtyjqlhwjhdWUby8+SSLbTQewbszWLiziqpk+w ngcg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@infradead.org header.s=bombadil.20170209 header.b=tOa9imBB; 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 68-v6si16293107pla.452.2018.05.04.11.33.22 for (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Fri, 04 May 2018 11:33:23 -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=tOa9imBB; 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=/BDKIHN8jdX724Mg9Q26nBY8EGhAQqCzvEkBVDhP1gU=; b=tOa9imBB9gBe4AjQLrwCa7c7n ornk96Kx9Y5JRE/bMaZG/SdxRNf8Mp5pjk3+dSkrIFEjCz4rVpWE3BmL1EbLyNV2TfmuBJaaiq7A2 u3MHj3iAJ6mGT+ZzlzyjSCh6IIxMqeo1d9tx9fDUWrWsqao8hLFK508KvPESwNisRPy6eU11KQ6F0 neNn2ssh1BbKkwqdHsDtMQPY4BX3AfTg5uuC5VVc4gqqSm+c+HvIdoIRegs1EzgdzRi5j1dOhGDep V8MrUgGnvBZhAL85p3hbLLvLp5Q+RCwdj/mPKRyiBPT58T3HC2fbD/nK+9SNJkgv3aFQFHC9ZZvio hLncZ86Tg==; Received: from willy by bombadil.infradead.org with local (Exim 4.90_1 #2 (Red Hat Linux)) id 1fEfWE-0003ls-8n; Fri, 04 May 2018 18:33:22 +0000 From: Matthew Wilcox To: linux-mm@kvack.org Cc: Matthew Wilcox , Andrew Morton , "Kirill A . Shutemov" , Christoph Lameter , Lai Jiangshan , Pekka Enberg , Vlastimil Babka , Dave Hansen , =?UTF-8?q?J=C3=A9r=C3=B4me=20Glisse?= Subject: [PATCH v5 06/17] mm: Move _refcount out of struct page union Date: Fri, 4 May 2018 11:33:07 -0700 Message-Id: <20180504183318.14415-7-willy@infradead.org> X-Mailer: git-send-email 2.14.3 In-Reply-To: <20180504183318.14415-1-willy@infradead.org> References: <20180504183318.14415-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 From: Matthew Wilcox Keeping the refcount in the union only encourages people to put something else in the union which will overlap with _refcount and eventually explode messily. pahole reports no fields change location. Signed-off-by: Matthew Wilcox Acked-by: Vlastimil Babka Acked-by: Kirill A. Shutemov --- include/linux/mm_types.h | 25 ++++++++++--------------- 1 file changed, 10 insertions(+), 15 deletions(-) diff --git a/include/linux/mm_types.h b/include/linux/mm_types.h index 23378a789af4..9828cd170251 100644 --- a/include/linux/mm_types.h +++ b/include/linux/mm_types.h @@ -113,7 +113,13 @@ struct page { }; }; - union { + union { /* This union is 4 bytes in size. */ + /* + * If the page can be mapped to userspace, encodes the number + * of times this page is referenced by a page table. + */ + atomic_t _mapcount; + /* * If the page is neither PageSlab nor mappable to userspace, * the value stored here may help determine what this page @@ -124,22 +130,11 @@ struct page { unsigned int active; /* SLAB */ int units; /* SLOB */ - - struct { /* Page cache */ - /* - * Count of ptes mapped in mms, to show when - * page is mapped & limit reverse map searches. - */ - atomic_t _mapcount; - - /* - * Usage count, *USE WRAPPER FUNCTION* when manual - * accounting. See page_ref.h - */ - atomic_t _refcount; - }; }; + /* Usage count. *DO NOT USE DIRECTLY*. See page_ref.h */ + atomic_t _refcount; + /* * WARNING: bit 0 of the first word encode PageTail(). That means * the rest users of the storage space MUST NOT use the bit to