From patchwork Fri May 4 18:33:15 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Matthew Wilcox X-Patchwork-Id: 10381375 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 0C6B260353 for ; Fri, 4 May 2018 18:59:09 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id EF9F7294EA for ; Fri, 4 May 2018 18:59:08 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id E45072954C; Fri, 4 May 2018 18:59:08 +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 46DB229587 for ; Fri, 4 May 2018 18:59:04 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id C1CDE6B0271; Fri, 4 May 2018 14:33:29 -0400 (EDT) Delivered-To: linux-mm-outgoing@kvack.org Received: by kanga.kvack.org (Postfix, from userid 40) id B323E6B0273; Fri, 4 May 2018 14:33:29 -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 9F6276B0274; Fri, 4 May 2018 14:33:29 -0400 (EDT) X-Original-To: linux-mm@kvack.org X-Delivered-To: linux-mm@kvack.org Received: from mail-pf0-f200.google.com (mail-pf0-f200.google.com [209.85.192.200]) by kanga.kvack.org (Postfix) with ESMTP id 601B76B0271 for ; Fri, 4 May 2018 14:33:29 -0400 (EDT) Received: by mail-pf0-f200.google.com with SMTP id b64so17978026pfl.13 for ; Fri, 04 May 2018 11:33:29 -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=kDwhxgTIeflD/63do7mIY4C+hhdHrH6UC1d+aY0wh9s=; b=BvGvRz3qFUh3isPjhYDmFzmwdzgc/pGB1bNhEDJyyn+sDWCrjg6tBzdfdwVbdrBpo5 lGZVAK809rSk0e1LS8apy/eURjBejQk1XQE/Qx2UE9TQbLH2lYMs1tZI0ZJPrvFh+MwG zFp7g9g1c/+6vAFnHbStb885opFmKiHgF677fRyh3Zvic5EFYKj+C+5gh1XrwUVwknMy KJk4NOEoIIGLmefstCKKQQ5/pFzpmLgkGoJMJliIy9um71cHi9aphrFhJpXMd/KrlVJY AbaOdjBAz6cu+RR6Gb3tD1129zs9x8yFzdZ+1qJaJ5//kkFSV8BJFNwBYeTG5jo0QFfF qT4Q== X-Gm-Message-State: ALQs6tDjNETaBSEWf2Ucl/3cHO6JkGts+fMOKWNl2OGNT9rtHe7fLp+X mXvOHEk9p9wTxxSJV7C85JVRPA+jStvgP6AlTM9TWTBRm7OLWtPQ+1phvZM/uMoNlK85akfNnBd WZXtpOiB7mEVusw0cVjm69XloWu6pe3RRioLpj6XMoqPxoA+3REAayJsSJHGh9B6Zuw== X-Received: by 2002:a17:902:462:: with SMTP id 89-v6mr28474036ple.300.1525458809072; Fri, 04 May 2018 11:33:29 -0700 (PDT) X-Google-Smtp-Source: AB8JxZpicm5yyUPF39wEg9AVMGVHN3rtoYUmUkr8vSFbFnThxWTRmR1wlURm1toWf8rp+HGu9G3f X-Received: by 2002:a17:902:462:: with SMTP id 89-v6mr28473994ple.300.1525458807955; Fri, 04 May 2018 11:33:27 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1525458807; cv=none; d=google.com; s=arc-20160816; b=n9M85SxtZRtKAjiR8jHzdAIlt5zu5ebwffs6RomY6eu9VR6gxAn64gGil6anWR4KFZ 7RohoY0WkYfuPwdgvmDPrfYZI+KnvE2vtVuEZ9G+iuxxJR6ebYJda/pdJLcHerX5cifN VuWpjUHpUzgfb2Rh0uVj97XI4fRAoRsoRZ6seXpQ8NKuoVs4MGeed+0AyVeBHlQQW0zu a3b7w+AjVwOXFFB0E00+IisaQOLefT5D8ptAzKIUZBQDfzrtco7yRbk0Yb25xRSPxmcL p0U5NZZicJQoQiph5OzDeT7pGEkJ74/FkCyBeTxWOGc4OM2/clsRxv+o0+d9uyI9R1YN zC6Q== 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=kDwhxgTIeflD/63do7mIY4C+hhdHrH6UC1d+aY0wh9s=; b=IfUlOk2WurWN7drwyyNX0wm0drpi/frAn/mxC5iQV12m2dyE45RFLWA3UHH1YT2TRS nKHX/KH67bwoyLTtXu7MWVFGEv2nZEpXj5hkM2iP+DemG+8gcX4ofIiPopgTSexEWxWI 8lMhRBpB6enxZNLPGhxA7SwS9WCRW9VskbCug+wRP0AXZfZieZ19KIgYz+wvqs8vIh74 fOFakpSUNgcAP8XmJdaAxxFRxw60d7w4wJSmimdlJZw9756UCmZ6RLOiZKhPvIxGAD1I TB5iROomPevkknJgLZNnIgp/1z2NccPTUsSqcI69QtrfcNF1a1IxDF534ojnuLgCH1OS Ocug== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@infradead.org header.s=bombadil.20170209 header.b=jHtBAj1H; 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 b5-v6si16824272plm.202.2018.05.04.11.33.27 for (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Fri, 04 May 2018 11:33:27 -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=jHtBAj1H; 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=kDwhxgTIeflD/63do7mIY4C+hhdHrH6UC1d+aY0wh9s=; b=jHtBAj1HB0hSQtjwTRKwggMXo wt0NFybGluKe0f1sEEejMOkoJiTjGEldPQmDIARZgnd+hyqxV+ujIwHfF40HbNU5yRnC2GIt6u7xF Bw2jXvvKm8oKzSPvRBHVmihm2uEUtV/0fYNH1HI7k1/tOcGKhgKJ8IviRmqqMOyhdkv59DjgqEMkE SU6IloIa6QC7IYBObvv2AgRTLFISInu4QKS7uKb8x7TrjqQXi8azChomOVhXEAWKHaxHixY8JEAvm P+JwGC/S17gU9oVbbZOSxlrWRurSmWTf5p/gfiR/tskPqLVb4t0mHnVStaxMvKeYviuoqUsvFfJH5 logtkulsg==; Received: from willy by bombadil.infradead.org with local (Exim 4.90_1 #2 (Red Hat Linux)) id 1fEfWI-0003nr-OP; Fri, 04 May 2018 18:33:26 +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 14/17] slab,slub: Remove rcu_head size checks Date: Fri, 4 May 2018 11:33:15 -0700 Message-Id: <20180504183318.14415-15-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 rcu_head may now grow larger than list_head without affecting slab or slub. Signed-off-by: Matthew Wilcox Acked-by: Christoph Lameter Acked-by: Vlastimil Babka --- mm/slab.c | 2 -- mm/slub.c | 27 ++------------------------- 2 files changed, 2 insertions(+), 27 deletions(-) diff --git a/mm/slab.c b/mm/slab.c index e387a17d6d56..e6ab1327db25 100644 --- a/mm/slab.c +++ b/mm/slab.c @@ -1235,8 +1235,6 @@ void __init kmem_cache_init(void) { int i; - BUILD_BUG_ON(sizeof(((struct page *)NULL)->lru) < - sizeof(struct rcu_head)); kmem_cache = &kmem_cache_boot; if (!IS_ENABLED(CONFIG_NUMA) || num_possible_nodes() == 1) diff --git a/mm/slub.c b/mm/slub.c index 57a20f995220..8e2407f69855 100644 --- a/mm/slub.c +++ b/mm/slub.c @@ -1681,17 +1681,9 @@ static void __free_slab(struct kmem_cache *s, struct page *page) __free_pages(page, order); } -#define need_reserve_slab_rcu \ - (sizeof(((struct page *)NULL)->lru) < sizeof(struct rcu_head)) - static void rcu_free_slab(struct rcu_head *h) { - struct page *page; - - if (need_reserve_slab_rcu) - page = virt_to_head_page(h); - else - page = container_of((struct list_head *)h, struct page, lru); + struct page *page = container_of(h, struct page, rcu_head); __free_slab(page->slab_cache, page); } @@ -1699,19 +1691,7 @@ static void rcu_free_slab(struct rcu_head *h) static void free_slab(struct kmem_cache *s, struct page *page) { if (unlikely(s->flags & SLAB_TYPESAFE_BY_RCU)) { - struct rcu_head *head; - - if (need_reserve_slab_rcu) { - int order = compound_order(page); - int offset = (PAGE_SIZE << order) - s->reserved; - - VM_BUG_ON(s->reserved != sizeof(*head)); - head = page_address(page) + offset; - } else { - head = &page->rcu_head; - } - - call_rcu(head, rcu_free_slab); + call_rcu(&page->rcu_head, rcu_free_slab); } else __free_slab(s, page); } @@ -3578,9 +3558,6 @@ static int kmem_cache_open(struct kmem_cache *s, slab_flags_t flags) s->random = get_random_long(); #endif - if (need_reserve_slab_rcu && (s->flags & SLAB_TYPESAFE_BY_RCU)) - s->reserved = sizeof(struct rcu_head); - if (!calculate_sizes(s, -1)) goto error; if (disable_higher_order_debug) {