From patchwork Fri May 4 18:33:05 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Matthew Wilcox X-Patchwork-Id: 10381347 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 3890B60542 for ; Fri, 4 May 2018 18:59:05 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 292062957C for ; Fri, 4 May 2018 18:59:05 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 1D1D829597; Fri, 4 May 2018 18:59:05 +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 45BE329584 for ; Fri, 4 May 2018 18:59:04 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 788616B0266; Fri, 4 May 2018 14:33:24 -0400 (EDT) Delivered-To: linux-mm-outgoing@kvack.org Received: by kanga.kvack.org (Postfix, from userid 40) id 737026B026A; Fri, 4 May 2018 14:33:24 -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 5FEC06B0269; Fri, 4 May 2018 14:33:24 -0400 (EDT) X-Original-To: linux-mm@kvack.org X-Delivered-To: linux-mm@kvack.org Received: from mail-pg0-f71.google.com (mail-pg0-f71.google.com [74.125.83.71]) by kanga.kvack.org (Postfix) with ESMTP id 19D8B6B0003 for ; Fri, 4 May 2018 14:33:24 -0400 (EDT) Received: by mail-pg0-f71.google.com with SMTP id w3-v6so14176451pgv.17 for ; Fri, 04 May 2018 11:33:24 -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=vrDqsJ4DR9ZpPWGZRNaBOFlHhUmN1n147kGMntHgVsQ=; b=jz7g8Lxnuo1qsuvj1K3k9doZPrdcomQ9Ql7wPMVoR9YeXwFjEtwUKhmLP+XtpQOHHS 2xLLWuXtpALCD886bU5slhjglT629uBfYuFygEFRjDV+dSMFOFvCrEbnWiqaR4GIzW+O QybOllEldNjbjmAbbygJVkHe/YfT27NSQXlBYavWvIC5rmPrsUanYHeVSwX+XjO9Bj5z q4IU1QFXG6jW9NIpJfNyWhleP7ZPHgCUylk2j7hxLP7g0Y/iYr3MBSg2lj2Wcr6koEJI auum94LXvcgdUChMTMCrdHcY1mCEwP3ubdh7Ku++vTrY/MFRZ8x7tV53Ovvw+JAZE2xl A5jg== X-Gm-Message-State: ALQs6tDAGNiL7FEKqLc4D1AieWQDTo1sXND4ky7Wu6quYQzuDzQ1h+3R Iwx9rRW3kzlyd/7Y7bw56O/uSUPlUthZx0nRIqq8n/MYHBZkiaKlp2ltAYPxmeMxhwesjMznKOO aRNsY5jYQhrPHC6roHBaUy2uob4y7xQY6+MX3v8AQx3H/0HjGwh6og2J9AUJGkRfELg== X-Received: by 2002:a17:902:7c94:: with SMTP id y20-v6mr29099640pll.56.1525458803803; Fri, 04 May 2018 11:33:23 -0700 (PDT) X-Google-Smtp-Source: AB8JxZplilOFJZJfscEqEupQv3ZlFvUHRHJQ7OjZRarSlpjPc9Vlv2VUPnYaemIQ9V+sqUwVCW24 X-Received: by 2002:a17:902:7c94:: with SMTP id y20-v6mr29099589pll.56.1525458802584; Fri, 04 May 2018 11:33:22 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1525458802; cv=none; d=google.com; s=arc-20160816; b=foA7z8Kqf39GdaXGGqn9m1tm/dQ3Zbzjd3ZXbWvmfS0w4626osvbwQ3VNDGHLq8f/l C020pRT+IaWoDBYHO6utP/gUC+fvTDk2BQEDjGMBWOrhvJxHgKBz8n83S0BRz+zDa994 DD5FeUFVXmO/BCqheeSt5vSmkNvPlNWGqyRUfFtIuGmEG2sdQmejBTnpHeAeCmx2s8K5 Zzm7zpNHsR0q15rPQaP2Jgby5r/4eKmnSHRqJJCu+Ji29Sjf0Zt4Jd1zCBDrhvDrb2SK PjEHwUvIQspQPnvRPdUAhw0EfRJmrgQKNrR1BW1NQWkP0OnuuMNIvr1ZdNidmWpgyBao vI3Q== 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=vrDqsJ4DR9ZpPWGZRNaBOFlHhUmN1n147kGMntHgVsQ=; b=tu+03YQLN6YfdPi29U2Xp7/Ezbeu321F/pOZV7z4gL7mN5yOzSJYOiqa7WFmKNsC24 me9w23p9NxdfRA8QjTGJSYblyY6tYDPm91KJlCAtCfZ3oHqJEtKlxBdK8ExU5/YD5PMB C33ikfpTQyE5m/QNUVcPnz4u5KhQBayqF6DVEkiluEMoyJrF2EEq+k9ax6NH55/OPmSN kkqaoIgGzFZB0Q0UCQ/U2oA8rOZsAVuRHmZu7V7BES5kcuoP1VUxZZdzmlSaK0UAXarH WRH9Y+r/Jfq0myjSL1DOQ+sYR6EZZzz6rJBptuodFPCdWUqsqDeP9xJtVfBlWkEa+YHU FJvA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@infradead.org header.s=bombadil.20170209 header.b=YNVVGgVs; 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 bg6-v6si14451216plb.243.2018.05.04.11.33.22 for (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Fri, 04 May 2018 11:33:22 -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=YNVVGgVs; 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=vrDqsJ4DR9ZpPWGZRNaBOFlHhUmN1n147kGMntHgVsQ=; b=YNVVGgVs8b0E5rLeNK/agXu4R UcfWPI/HOAmu6hugAOjj3tm/j0Dgx0N9eKkMa91/1iiv7LOQSAXlad6fITjH4aoaFkGZT5iStrXGo 05Md4LDPDNWXU68k1O8hrUhcXaK5bCuOZd+8YSr5ZVoTMgLS88rtTaX2hJjUsbkHlJ7oH08+tml+J 85YfdMecHn3yhiyEGz0BgxJuMEKMGR+ofiOitIKXS6HCPnu8Ofs6Bpd5ET3m2zoco9DsZNupsEtIu grwWmf39I7RpUYsdIAsgYq47Z7D1Gl3ytIDaY36axNRZYlcx0osXiij9s6QbB2zYksOztvucV+SjN O5hNRYhdA==; Received: from willy by bombadil.infradead.org with local (Exim 4.90_1 #2 (Red Hat Linux)) id 1fEfWD-0003lk-Bu; Fri, 04 May 2018 18:33:21 +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 04/17] mm: Switch s_mem and slab_cache in struct page Date: Fri, 4 May 2018 11:33:05 -0700 Message-Id: <20180504183318.14415-5-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 This will allow us to store slub's counters in the same bits as slab's s_mem. slub now needs to set page->mapping to NULL as it frees the page, just like slab does. Signed-off-by: Matthew Wilcox Acked-by: Christoph Lameter Acked-by: Vlastimil Babka --- include/linux/mm_types.h | 4 ++-- mm/slub.c | 1 + 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/include/linux/mm_types.h b/include/linux/mm_types.h index 41828fb34860..e97a310a6abe 100644 --- a/include/linux/mm_types.h +++ b/include/linux/mm_types.h @@ -83,7 +83,7 @@ struct page { /* See page-flags.h for the definition of PAGE_MAPPING_FLAGS */ struct address_space *mapping; - void *s_mem; /* slab first object */ + struct kmem_cache *slab_cache; /* SL[AU]B: Pointer to slab */ atomic_t compound_mapcount; /* first tail page */ /* page_deferred_list().next -- second tail page */ }; @@ -194,7 +194,7 @@ struct page { spinlock_t ptl; #endif #endif - struct kmem_cache *slab_cache; /* SL[AU]B: Pointer to slab */ + void *s_mem; /* slab first object */ }; #ifdef CONFIG_MEMCG diff --git a/mm/slub.c b/mm/slub.c index e938184ac847..7fc13c46e975 100644 --- a/mm/slub.c +++ b/mm/slub.c @@ -1690,6 +1690,7 @@ static void __free_slab(struct kmem_cache *s, struct page *page) __ClearPageSlab(page); page_mapcount_reset(page); + page->mapping = NULL; if (current->reclaim_state) current->reclaim_state->reclaimed_slab += pages; memcg_uncharge_slab(page, order, s);