From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-6.6 required=3.0 tests=DKIM_SIGNED,DKIM_VALID, DKIM_VALID_AU,FREEMAIL_FORGED_FROMDOMAIN,FREEMAIL_FROM, HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_PATCH,MAILING_LIST_MULTI,SIGNED_OFF_BY, SPF_HELO_NONE,SPF_PASS autolearn=unavailable autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 02D47C2D0DC for ; Fri, 27 Dec 2019 01:04:06 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id 972DB2080D for ; Fri, 27 Dec 2019 01:04:05 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="Li1O3yUJ" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 972DB2080D Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=gmail.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=owner-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix) id E115E8E0005; Thu, 26 Dec 2019 20:04:04 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id DC2C98E0001; Thu, 26 Dec 2019 20:04:04 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id CD87B8E0005; Thu, 26 Dec 2019 20:04:04 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0071.hostedemail.com [216.40.44.71]) by kanga.kvack.org (Postfix) with ESMTP id B95838E0001 for ; Thu, 26 Dec 2019 20:04:04 -0500 (EST) Received: from smtpin17.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay01.hostedemail.com (Postfix) with SMTP id 7A3EF180AD801 for ; Fri, 27 Dec 2019 01:04:04 +0000 (UTC) X-FDA: 76309124808.17.gate60_5dbce6a9a8816 X-HE-Tag: gate60_5dbce6a9a8816 X-Filterd-Recvd-Size: 5779 Received: from mail-io1-f65.google.com (mail-io1-f65.google.com [209.85.166.65]) by imf19.hostedemail.com (Postfix) with ESMTP for ; Fri, 27 Dec 2019 01:04:04 +0000 (UTC) Received: by mail-io1-f65.google.com with SMTP id c16so23110399ioh.6 for ; Thu, 26 Dec 2019 17:04:03 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=Sm197CHJjHN6LEdkX01bTusjZhcWBh9t5ofpInbcGek=; b=Li1O3yUJ/WcaGdAIwYXi16c4e/l8vbUkYPvw1M2FhtVw62AqlWsfQHJLMldXls9Jkd f14Yj1PfgLvDtf4oo4Cf/ahir7zoZRJfAwiLbqIqfiUEMS2qof+x8PSBLLjE0SWRVV24 Ox6E0YZKXs26bMhGbHKOK/TuRzolfdGloR7mXPJPbT1s1WcDkQDghKl5R6J6AY89LoLb KYHBzgUbLhSzGutsGyuc8PNLZMlcqZ6Qr1cTX+9J/1MlRcFHyN9Q5iWjIBeUfkUaMCFl /DZZsYi1rWBj5r45c+Pmt+30c2wpXjdVpB8J2AGJz2Fex8krJNCqwnj26lD3MU1Wta3V G/7A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=Sm197CHJjHN6LEdkX01bTusjZhcWBh9t5ofpInbcGek=; b=ZNioVWttN1Mjv0O+aFjWK4N+avPIycOyBUW9xysrXlNErp+gzbRon8FjaHK5dIhcQ9 yHJ15kIAmBzDzhNShrJDmCoM0i8fwBybOuz8jY0jZCf1rOlqWXaptsod7uXJyYIVsWhU Uh1gW6r/obqK4GisowXziS2yqt7uRKU5PLP7aI08E4VjvRR/6saZLyHFPKe+Ynl58tR4 GG0i5ffUJc8PZfaGLbBXL7PBpdw/0hk5VX28WeCMyyTl8a92QVrYxvsaTSagwYtxR3Vb SR1Ee8mWK24NApUSD75pE9RMCa68pjgfMSu1UY7JAuaAUXGETBt8PrJX7GbGTo77hjSk /IFQ== X-Gm-Message-State: APjAAAWSUh+GW6LsGkvZOVwxKp6T4lUuQHsytC6LVjWFBY6IyyypmCQw E0nj53awWJX0QVLmzkqu/F85cSaV0okPDviRKC0= X-Google-Smtp-Source: APXvYqyTYz+FFa8wQ1NLm83a6cU06qGs79Dhp75qEi35sGCZAl4l9Sq0dk8QvvzZpl/XEGpM80GyOCJE8jlHgiBMqbk= X-Received: by 2002:a02:856a:: with SMTP id g97mr38412724jai.97.1577408643244; Thu, 26 Dec 2019 17:04:03 -0800 (PST) MIME-Version: 1.0 References: <1577174006-13025-1-git-send-email-laoar.shao@gmail.com> <1577174006-13025-2-git-send-email-laoar.shao@gmail.com> <20191226212320.GA22734@tower.dhcp.thefacebook.com> In-Reply-To: <20191226212320.GA22734@tower.dhcp.thefacebook.com> From: Yafang Shao Date: Fri, 27 Dec 2019 09:03:27 +0800 Message-ID: Subject: Re: [PATCH v2 1/5] mm, memcg: reduce size of struct mem_cgroup by using bit field To: Roman Gushchin Cc: "hannes@cmpxchg.org" , "david@fromorbit.com" , "mhocko@kernel.org" , "vdavydov.dev@gmail.com" , "akpm@linux-foundation.org" , "viro@zeniv.linux.org.uk" , "linux-mm@kvack.org" , "linux-fsdevel@vger.kernel.org" Content-Type: text/plain; charset="UTF-8" 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: On Fri, Dec 27, 2019 at 5:23 AM Roman Gushchin wrote: > > On Tue, Dec 24, 2019 at 02:53:22AM -0500, Yafang Shao wrote: > > There are some members in struct mem_group can be either 0(false) or > > 1(true), so we can define them using bit field to reduce size. With this > > patch, the size of struct mem_cgroup can be reduced by 64 bytes in theory, > > but as there're some MEMCG_PADDING()s, the real number may be different, > > which is relate with the cacheline size. Anyway, this patch could reduce > > the size of struct mem_cgroup more or less. > > It seems it's not really related to the rest of the patchset, isn't it? > Right. > Can you, please, post it separately? > Sure. Will post it separately. > Also, I'd move the tcp-related stuff up, so that all oom-related fields > would be together. OK. Thanks for your comment. > Otherwise lgtm. > > Thanks! > > > > > Signed-off-by: Yafang Shao > > --- > > include/linux/memcontrol.h | 21 ++++++++++++--------- > > 1 file changed, 12 insertions(+), 9 deletions(-) > > > > diff --git a/include/linux/memcontrol.h b/include/linux/memcontrol.h > > index a7a0a1a5..612a457 100644 > > --- a/include/linux/memcontrol.h > > +++ b/include/linux/memcontrol.h > > @@ -229,20 +229,26 @@ struct mem_cgroup { > > /* > > * Should the accounting and control be hierarchical, per subtree? > > */ > > - bool use_hierarchy; > > + unsigned int use_hierarchy : 1; > > > > /* > > * Should the OOM killer kill all belonging tasks, had it kill one? > > */ > > - bool oom_group; > > + unsigned int oom_group : 1; > > > > /* protected by memcg_oom_lock */ > > - bool oom_lock; > > - int under_oom; > > + unsigned int oom_lock : 1; > > > > - int swappiness; > > /* OOM-Killer disable */ > > - int oom_kill_disable; > > + unsigned int oom_kill_disable : 1; > > + > > + /* Legacy tcp memory accounting */ > > + unsigned int tcpmem_active : 1; > > + unsigned int tcpmem_pressure : 1; > > + > > + int under_oom; > > + > > + int swappiness; > > > > /* memory.events and memory.events.local */ > > struct cgroup_file events_file; > > @@ -297,9 +303,6 @@ struct mem_cgroup { > > > > unsigned long socket_pressure; > > > > - /* Legacy tcp memory accounting */ > > - bool tcpmem_active; > > - int tcpmem_pressure; > > > > #ifdef CONFIG_MEMCG_KMEM > > /* Index in the kmem_cache->memcg_params.memcg_caches array */ > > -- > > 1.8.3.1 > > > >