All of lore.kernel.org
 help / color / mirror / Atom feed
From: Roman Gushchin <guro@fb.com>
To: Johannes Weiner <hannes@cmpxchg.org>
Cc: Andrew Morton <akpm@linux-foundation.org>,
	Shakeel Butt <shakeelb@google.com>,
	Michal Hocko <mhocko@kernel.org>, <linux-kernel@vger.kernel.org>,
	<linux-mm@kvack.org>, <kernel-team@fb.com>
Subject: Re: [PATCH v4 1/4] mm: memcontrol: use helpers to access page's memcg data
Date: Thu, 1 Oct 2020 13:51:43 -0700	[thread overview]
Message-ID: <20201001205143.GE2706729@carbon.DHCP.thefacebook.com> (raw)
In-Reply-To: <20201001185950.GB500308@cmpxchg.org>

On Thu, Oct 01, 2020 at 02:59:50PM -0400, Johannes Weiner wrote:
> On Thu, Oct 01, 2020 at 11:27:39AM -0700, Roman Gushchin wrote:
> > On Thu, Oct 01, 2020 at 09:46:38AM -0400, Johannes Weiner wrote:
> > > On Wed, Sep 30, 2020 at 05:27:07PM -0700, Roman Gushchin wrote:
> > > > +/*
> > > > + * set_page_memcg - associate a page with a memory cgroup
> > > > + * @page: a pointer to the page struct
> > > > + * @memcg: a pointer to the memory cgroup
> > > > + *
> > > > + * Associates a page with a memory cgroup.
> > > > + */
> > > > +static inline void set_page_memcg(struct page *page, struct mem_cgroup *memcg)
> > > > +{
> > > > +	VM_BUG_ON_PAGE(PageSlab(page), page);
> > > > +
> > > > +	/*
> > > > +	 * Please, refer to page_memcg()'s description for the page and memcg
> > > > +	 * binding stability requirements.
> > > > +	 */
> > > > +	page->memcg_data = (unsigned long)memcg;
> > > > +}
> > > 
> > > Please delete and inline this as per previous feedback, thanks.
> > 
> > Why it's better?
> > It's ok for set_page_memcg(), but obviously worse for set_page_objcgs():
> > it was nice to have all bit magic in one place, in few helper functions.
> > And now it spills into several places. What's the win?
> 
> set_page_objcgs() is a worthwhile abstraction because it includes the
> synchronization primitives that make it safe to use wrt
> page_objcgs(). They encapsulate the cmpxchg and the READ_ONCE().
> 
> set_page_memcg() doesn't do any synchronization and relies fully on
> the contextual locking. The name implies that it includes things to
> make it safe wrt page_memcg(), which isn't true at all. It's a long
> and misleading name for '='.
> 
> Btw, I really don't mind having this discussion, but please don't send
> revisions that silently ignore feedback you don't agree with.

I'm not ignoring: I thought you was looking to remove clear_page_* functions,
but it wasn't clear you want eliminate set_page_memcg() function. Please, when
you asking for some "style" changes, please, provide some rationale, it's way
less obvious than you think, what exactly you don't like in the proposed version.

Thanks.

  reply	other threads:[~2020-10-01 20:52 UTC|newest]

Thread overview: 17+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-10-01  0:27 [PATCH v4 0/4] mm: allow mapping accounted kernel pages to userspace Roman Gushchin
2020-10-01  0:27 ` [PATCH v4 1/4] mm: memcontrol: use helpers to access page's memcg data Roman Gushchin
2020-10-01 13:46   ` Johannes Weiner
2020-10-01 18:27     ` Roman Gushchin
2020-10-01 18:59       ` Johannes Weiner
2020-10-01 20:51         ` Roman Gushchin [this message]
2020-10-02 14:22           ` Johannes Weiner
2020-10-01  0:27 ` [PATCH v4 2/4] mm: memcontrol/slab: use helpers to access slab page's memcg_data Roman Gushchin
2020-10-01  0:27 ` [PATCH v4 3/4] mm: introduce page memcg flags Roman Gushchin
2020-10-01 13:44   ` Johannes Weiner
2020-10-01  0:27 ` [PATCH v4 4/4] mm: convert page kmemcg type to a page memcg flag Roman Gushchin
2020-10-01 13:48   ` Johannes Weiner
2020-10-01 17:00   ` Michal Koutný
2020-10-01 17:27     ` Johannes Weiner
2020-10-02 10:03       ` Michal Koutný
2020-10-02 13:25         ` Johannes Weiner
2020-10-01 18:30     ` Roman Gushchin

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20201001205143.GE2706729@carbon.DHCP.thefacebook.com \
    --to=guro@fb.com \
    --cc=akpm@linux-foundation.org \
    --cc=hannes@cmpxchg.org \
    --cc=kernel-team@fb.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mm@kvack.org \
    --cc=mhocko@kernel.org \
    --cc=shakeelb@google.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.