From patchwork Fri May 18 19:45:08 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Matthew Wilcox (Oracle)" X-Patchwork-Id: 10411985 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 0E6E36031B for ; Fri, 18 May 2018 19:45:49 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id F20FD20499 for ; Fri, 18 May 2018 19:45:48 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id E65CB28A4F; Fri, 18 May 2018 19:45:48 +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 7F18920499 for ; Fri, 18 May 2018 19:45:48 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 107E66B066A; Fri, 18 May 2018 15:45:32 -0400 (EDT) Delivered-To: linux-mm-outgoing@kvack.org Received: by kanga.kvack.org (Postfix, from userid 40) id 095106B0669; Fri, 18 May 2018 15:45:31 -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 C093F6B066B; Fri, 18 May 2018 15:45:31 -0400 (EDT) X-Original-To: linux-mm@kvack.org X-Delivered-To: linux-mm@kvack.org Received: from mail-pl0-f69.google.com (mail-pl0-f69.google.com [209.85.160.69]) by kanga.kvack.org (Postfix) with ESMTP id 764FA6B0667 for ; Fri, 18 May 2018 15:45:31 -0400 (EDT) Received: by mail-pl0-f69.google.com with SMTP id x32-v6so5610732pld.16 for ; Fri, 18 May 2018 12:45:31 -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=KhiiKEzn7d6xzliK68baShSXyCFVPQYsLwxBEgG0UKp2OylHV/EebTb5D05DiobFuu q+I88DXb0hn8fXHatFCO+C7yYUkFpGq/gqiGtnDivtZkTiH8LudUoY78aJtnovzkxU7P ezBlRA51vJwL4F6aE9kfUi+tBRx18b+KVcOPUON6p4vLuiQHQ1l/uxl9fDkr0VyCtsNW ZHkQhjNQWdFQfa+MKUGed2ca7wzkiSwrUqPfzJEfAAl+qAG7nbgHXe2DedeC391m5GVJ VpiuPabRtr1AUmsREL391ARQUYePZa/KcydkwITmvKrcA4FY2xD55E2g4q1pimI+YXEI rPnA== X-Gm-Message-State: ALKqPwfQTm7KzQd55eX8+pZeBDy+/aGBCEsNNLqjnhMabIk7JCN334w/ 5EOq7YeU6AD4qHcukl1/h2sp3AYRo4d4AFsRbJzrR9ajzJTO45gmsbzgEvzpSsiqYXjqS/uPkjc lq/pzygv1YJScyiXuG7udLhrcg8oU1Md/TbC3kRpOuaz0XfYxLdyYjcrXmHxlocxW1A== X-Received: by 2002:a63:91c4:: with SMTP id l187-v6mr8452369pge.261.1526672731127; Fri, 18 May 2018 12:45:31 -0700 (PDT) X-Google-Smtp-Source: AB8JxZpQrmTa1EX8P4+t6VZFAlZ2ghLR+gMThf29n9yXPjuCxV8UkkN1asUIeFxAZCtJ3rdUZ4G3 X-Received: by 2002:a63:91c4:: with SMTP id l187-v6mr8452167pge.261.1526672723580; Fri, 18 May 2018 12:45:23 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1526672723; cv=none; d=google.com; s=arc-20160816; b=e4RjDqsgCxGG2tIX6X58FhFP3hql65zOf3M+VWvqLw66KqEHeYd5+3S9lQNh937IIS a3VvnZBcGTSGoX3wtCTCWA46lBbZQ+RUn98INM2ob9zOAg4q9DZF1i11QKoiYBqLWXfG ce+x0CoZYk/O2S78U+xc5wzxs3EPtVeqUZ7LY11mIgW28phSFOlFpE2k8iWvBG69ALv9 yAtW5LITz1PVfOrQMoYPTTrYdBYDeqSUwkGKuKMNhoaZ6kyZeewSNSV2qWZ07pk7bkuC /W+tII3PoSKdcJ8RHAPN6wUqrgPQVFEwbJKPv/JXuiq/rXBXGwRznur2BzJgCACVbUx1 7k4g== 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=E0WPwraYSBxTpCo7atEntUSF6o9DJFM9kFQZu2jxYQncWXa8QKAgEZCZguKsgv0ibb KEbPz9+u6kNrc4f6mKH2LBO36r4rDDMzBvOIGtzHSGHGQmmlOAnKoq6Utf0moscUr04M 1WKbGoFrSxxLi3OxJHALLE0aR4uA49sTASUOxBpNrTlSVqHrPe0gxRFeZXDnBuq5i28L 7+dMqoNI59Yp8mNVbwsPGFlcn0+E4AUmwjUtVz6j9kLM1/t80Sqwz3DBNW9ltV4fL7cZ GLrCGpkBEYxddZ3XjyFI71P42bwnc8IcvUJRZmbatPqs8sO5siS2+iE58kkIfYzElqGF e3mA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@infradead.org header.s=bombadil.20170209 header.b=mpkI6XzW; 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 z26-v6si9025337pfl.209.2018.05.18.12.45.23 for (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Fri, 18 May 2018 12:45: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=mpkI6XzW; 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=mpkI6XzWj8ZHULngZDBWuq1lf jz2KM0bJ9GF4vE6h0AF927Fn9A82kg5p99+qGQ6w4zr4SP++mpl2YskdpEf7wfYJAyg9rPdX4noxx 0GW+e6R4smUGjbxyFe7KV5te24cua1nO4Mkn8sgS65tmIXFMgYlVoRoh0KE6rUApFIyJ1E+IVbBGq JswGs98PTub/4sOziUDhih9iuI7Ali3NqbKXk1MtRqMhGovxRc92+Xmcjvm4rB2mkbC6AwgvKZZGA pY4BGixXuCrl9HO9JTw4mHmRY+RwziISgQQzrnn5GY32bKprxTX+DU9am5XuKdxDlEu6ZH42WpZhw SljElEDnQ==; Received: from willy by bombadil.infradead.org with local (Exim 4.90_1 #2 (Red Hat Linux)) id 1fJlJa-00010s-KE; Fri, 18 May 2018 19:45: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 v6 06/17] mm: Move _refcount out of struct page union Date: Fri, 18 May 2018 12:45:08 -0700 Message-Id: <20180518194519.3820-7-willy@infradead.org> X-Mailer: git-send-email 2.14.3 In-Reply-To: <20180518194519.3820-1-willy@infradead.org> References: <20180518194519.3820-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