From: Johannes Weiner <hannes-druUgvl0LCNAfugRpC6u6w@public.gmane.org>
To: Matthew Wilcox <willy-wEGCiKHe2LqWVfeAwA7xHQ@public.gmane.org>
Cc: linux-mm-Bw31MaZKKs3YtjvyW6yDsg@public.gmane.org,
cgroups-u79uwXL29TY76Z2rM5mHXA@public.gmane.org,
Michal Hocko <mhocko-DgEjT+Ai2ygdnm+yROfE0A@public.gmane.org>,
Vladimir Davydov
<vdavydov.dev-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
Subject: Re: [PATCH v3 15/18] mm/memcg: Add mem_cgroup_folio_lruvec()
Date: Wed, 30 Jun 2021 17:21:12 -0400 [thread overview]
Message-ID: <YNzgSOkl77FHdfhV@cmpxchg.org> (raw)
In-Reply-To: <YNzDiTFZpRgKY0CE-FZi0V3Vbi30CUdFEqe4BF2D2FQJk+8+b@public.gmane.org>
On Wed, Jun 30, 2021 at 08:18:33PM +0100, Matthew Wilcox wrote:
> On Wed, Jun 30, 2021 at 05:00:31AM +0100, Matthew Wilcox (Oracle) wrote:
> > This is the folio equivalent of mem_cgroup_page_lruvec().
>
> I'm just going through and removing the wrappers.
>
> Why is this function called this? There's an odd mix of
>
> lock_page_memcg()
This was chosen to match lock_page().
> page_memcg()
And this to match page_mapping(), page_zone() etc.
> count_memcg_page_event()
count_vm_event()
> split_page_memcg()
split_page(), split_page_owner()
> mem_cgroup_charge()
> mem_cgroup_swapin_charge_page()
These are larger, heavier subsystem API calls that modify all kinds of
state, not just the page. Hence the namespacing.
With the smaller getter/setter type functions on pages we have
traditionally used <verb>_<object> rather than page_<verb>, simply
because the page is such a low-level object and many functions do
sequences of page manipulations. Namespacing would turn them into:
page_do_this(page);
page_set_that(page);
page_lock(page);
if (page_is_blah(page))
page_mark_foo(page);
page_unlock(page);
page_put(page);
which is hard on the reader because it obscures the salient part of
each line behind repetetive boiler plate.
> mem_cgroup_lruvec()
This is arguably not a namespace prefix, but rather an accessor
function to look up the memcg's lruvec.
> mem_cgroup_from_task()
This is a pattern to look up memcgs from various objects:
- mem_cgroup_from_css()
- mem_cgroup_from_counter()
- mem_cgroup_from_id()
- mem_cgroup_from_seq()
- mem_cgroup_from_obj()
and we used to have mem_cgroup_from_page() at some point...
> I'd really like to call this function folio_lruvec().
That would be a better name indeed.
However, pairing renames with conversion is worrisome because it means
having two unintuitively diverging names for the same operation in the
API during a time where everybody has to relearn the code base already.
Please either precede it with a rename to page_lruvec(), or keep the
existing naming pattern in the conversion.
> It happens to behave differently if the folio is part of a memcg,
> but conceptually, lruvecs aren't particularly tied to memcgs.
Conceptually, lruvecs are always tied to a memcg. On !CONFIG_MEMCG
kernels that just happens to be the root cgroup.
But because it's an accessor to a page attribute, dropping the
namespacing prefix is in line with things like page_memcg().
WARNING: multiple messages have this Message-ID (diff)
From: Johannes Weiner <hannes@cmpxchg.org>
To: Matthew Wilcox <willy@infradead.org>
Cc: linux-mm@kvack.org, cgroups@vger.kernel.org,
Michal Hocko <mhocko@kernel.org>,
Vladimir Davydov <vdavydov.dev@gmail.com>
Subject: Re: [PATCH v3 15/18] mm/memcg: Add mem_cgroup_folio_lruvec()
Date: Wed, 30 Jun 2021 17:21:12 -0400 [thread overview]
Message-ID: <YNzgSOkl77FHdfhV@cmpxchg.org> (raw)
In-Reply-To: <YNzDiTFZpRgKY0CE@casper.infradead.org>
On Wed, Jun 30, 2021 at 08:18:33PM +0100, Matthew Wilcox wrote:
> On Wed, Jun 30, 2021 at 05:00:31AM +0100, Matthew Wilcox (Oracle) wrote:
> > This is the folio equivalent of mem_cgroup_page_lruvec().
>
> I'm just going through and removing the wrappers.
>
> Why is this function called this? There's an odd mix of
>
> lock_page_memcg()
This was chosen to match lock_page().
> page_memcg()
And this to match page_mapping(), page_zone() etc.
> count_memcg_page_event()
count_vm_event()
> split_page_memcg()
split_page(), split_page_owner()
> mem_cgroup_charge()
> mem_cgroup_swapin_charge_page()
These are larger, heavier subsystem API calls that modify all kinds of
state, not just the page. Hence the namespacing.
With the smaller getter/setter type functions on pages we have
traditionally used <verb>_<object> rather than page_<verb>, simply
because the page is such a low-level object and many functions do
sequences of page manipulations. Namespacing would turn them into:
page_do_this(page);
page_set_that(page);
page_lock(page);
if (page_is_blah(page))
page_mark_foo(page);
page_unlock(page);
page_put(page);
which is hard on the reader because it obscures the salient part of
each line behind repetetive boiler plate.
> mem_cgroup_lruvec()
This is arguably not a namespace prefix, but rather an accessor
function to look up the memcg's lruvec.
> mem_cgroup_from_task()
This is a pattern to look up memcgs from various objects:
- mem_cgroup_from_css()
- mem_cgroup_from_counter()
- mem_cgroup_from_id()
- mem_cgroup_from_seq()
- mem_cgroup_from_obj()
and we used to have mem_cgroup_from_page() at some point...
> I'd really like to call this function folio_lruvec().
That would be a better name indeed.
However, pairing renames with conversion is worrisome because it means
having two unintuitively diverging names for the same operation in the
API during a time where everybody has to relearn the code base already.
Please either precede it with a rename to page_lruvec(), or keep the
existing naming pattern in the conversion.
> It happens to behave differently if the folio is part of a memcg,
> but conceptually, lruvecs aren't particularly tied to memcgs.
Conceptually, lruvecs are always tied to a memcg. On !CONFIG_MEMCG
kernels that just happens to be the root cgroup.
But because it's an accessor to a page attribute, dropping the
namespacing prefix is in line with things like page_memcg().
next prev parent reply other threads:[~2021-06-30 21:21 UTC|newest]
Thread overview: 122+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-06-30 4:00 [PATCH v3 00/18] Folio conversion of memcg Matthew Wilcox (Oracle)
2021-06-30 4:00 ` Matthew Wilcox (Oracle)
[not found] ` <20210630040034.1155892-1-willy-wEGCiKHe2LqWVfeAwA7xHQ@public.gmane.org>
2021-06-30 4:00 ` [PATCH v3 01/18] mm: Add folio_nid() Matthew Wilcox (Oracle)
2021-06-30 4:00 ` Matthew Wilcox (Oracle)
[not found] ` <20210630040034.1155892-2-willy-wEGCiKHe2LqWVfeAwA7xHQ@public.gmane.org>
2021-07-01 6:56 ` Christoph Hellwig
2021-07-01 6:56 ` Christoph Hellwig
2021-06-30 4:00 ` [PATCH v3 02/18] mm/memcg: Remove 'page' parameter to mem_cgroup_charge_statistics() Matthew Wilcox (Oracle)
2021-06-30 4:00 ` Matthew Wilcox (Oracle)
[not found] ` <20210630040034.1155892-3-willy-wEGCiKHe2LqWVfeAwA7xHQ@public.gmane.org>
2021-06-30 14:17 ` Johannes Weiner
2021-06-30 14:17 ` Johannes Weiner
2021-06-30 4:00 ` [PATCH v3 03/18] mm/memcg: Use the node id in mem_cgroup_update_tree() Matthew Wilcox (Oracle)
2021-06-30 4:00 ` Matthew Wilcox (Oracle)
[not found] ` <20210630040034.1155892-4-willy-wEGCiKHe2LqWVfeAwA7xHQ@public.gmane.org>
2021-06-30 6:55 ` Michal Hocko
2021-06-30 6:55 ` Michal Hocko
2021-06-30 14:18 ` Johannes Weiner
2021-06-30 14:18 ` Johannes Weiner
2021-07-01 6:57 ` Christoph Hellwig
2021-07-01 6:57 ` Christoph Hellwig
2021-06-30 4:00 ` [PATCH v3 04/18] mm/memcg: Remove soft_limit_tree_node() Matthew Wilcox (Oracle)
2021-06-30 4:00 ` Matthew Wilcox (Oracle)
[not found] ` <20210630040034.1155892-5-willy-wEGCiKHe2LqWVfeAwA7xHQ@public.gmane.org>
2021-06-30 6:56 ` Michal Hocko
2021-06-30 6:56 ` Michal Hocko
2021-06-30 14:19 ` Johannes Weiner
2021-06-30 14:19 ` Johannes Weiner
2021-07-01 7:09 ` Christoph Hellwig
2021-07-01 7:09 ` Christoph Hellwig
2021-06-30 4:00 ` [PATCH v3 05/18] mm/memcg: Convert memcg_check_events to take a node ID Matthew Wilcox (Oracle)
2021-06-30 4:00 ` Matthew Wilcox (Oracle)
[not found] ` <20210630040034.1155892-6-willy-wEGCiKHe2LqWVfeAwA7xHQ@public.gmane.org>
2021-06-30 6:58 ` Michal Hocko
2021-06-30 6:58 ` Michal Hocko
[not found] ` <YNwWC8Nb3QfhMOTs-2MMpYkNvuYDjFM9bn6wA6Q@public.gmane.org>
2021-06-30 6:59 ` Michal Hocko
2021-06-30 6:59 ` Michal Hocko
2021-07-01 7:09 ` Christoph Hellwig
2021-07-01 7:09 ` Christoph Hellwig
2021-06-30 4:00 ` [PATCH v3 06/18] mm/memcg: Add folio_memcg() and related functions Matthew Wilcox (Oracle)
2021-06-30 4:00 ` Matthew Wilcox (Oracle)
[not found] ` <20210630040034.1155892-7-willy-wEGCiKHe2LqWVfeAwA7xHQ@public.gmane.org>
2021-06-30 6:53 ` kernel test robot
2021-06-30 6:53 ` kernel test robot
2021-06-30 6:53 ` kernel test robot
2021-07-01 7:12 ` Christoph Hellwig
2021-07-01 7:12 ` Christoph Hellwig
2021-06-30 4:00 ` [PATCH v3 07/18] mm/memcg: Convert commit_charge() to take a folio Matthew Wilcox (Oracle)
2021-06-30 4:00 ` Matthew Wilcox (Oracle)
2021-06-30 4:00 ` [PATCH v3 08/18] mm/memcg: Convert mem_cgroup_charge() " Matthew Wilcox (Oracle)
2021-06-30 4:00 ` Matthew Wilcox (Oracle)
[not found] ` <20210630040034.1155892-9-willy-wEGCiKHe2LqWVfeAwA7xHQ@public.gmane.org>
2021-06-30 7:17 ` kernel test robot
2021-06-30 7:17 ` kernel test robot
2021-06-30 7:17 ` kernel test robot
2021-07-01 7:13 ` Christoph Hellwig
2021-07-01 7:13 ` Christoph Hellwig
2021-06-30 4:00 ` [PATCH v3 09/18] mm/memcg: Convert uncharge_page() to uncharge_folio() Matthew Wilcox (Oracle)
2021-06-30 4:00 ` Matthew Wilcox (Oracle)
[not found] ` <20210630040034.1155892-10-willy-wEGCiKHe2LqWVfeAwA7xHQ@public.gmane.org>
2021-07-01 7:15 ` Christoph Hellwig
2021-07-01 7:15 ` Christoph Hellwig
2021-06-30 4:00 ` [PATCH v3 10/18] mm/memcg: Convert mem_cgroup_uncharge() to take a folio Matthew Wilcox (Oracle)
2021-06-30 4:00 ` Matthew Wilcox (Oracle)
[not found] ` <20210630040034.1155892-11-willy-wEGCiKHe2LqWVfeAwA7xHQ@public.gmane.org>
2021-06-30 8:46 ` kernel test robot
2021-06-30 8:46 ` kernel test robot
2021-06-30 8:46 ` kernel test robot
2021-07-01 7:17 ` Christoph Hellwig
2021-07-01 7:17 ` Christoph Hellwig
[not found] ` <YN1sHPnWUysOZiJm-wEGCiKHe2LqWVfeAwA7xHQ@public.gmane.org>
2021-07-07 12:09 ` Matthew Wilcox
2021-07-07 12:09 ` Matthew Wilcox
2021-06-30 4:00 ` [PATCH v3 11/18] mm/memcg: Convert mem_cgroup_migrate() to take folios Matthew Wilcox (Oracle)
2021-06-30 4:00 ` Matthew Wilcox (Oracle)
[not found] ` <20210630040034.1155892-12-willy-wEGCiKHe2LqWVfeAwA7xHQ@public.gmane.org>
2021-07-01 7:20 ` Christoph Hellwig
2021-07-01 7:20 ` Christoph Hellwig
2021-06-30 4:00 ` [PATCH v3 12/18] mm/memcg: Convert mem_cgroup_track_foreign_dirty_slowpath() to folio Matthew Wilcox (Oracle)
2021-06-30 4:00 ` Matthew Wilcox (Oracle)
2021-06-30 4:00 ` [PATCH v3 13/18] mm/memcg: Add folio_memcg_lock() and folio_memcg_unlock() Matthew Wilcox (Oracle)
2021-06-30 4:00 ` Matthew Wilcox (Oracle)
[not found] ` <20210630040034.1155892-14-willy-wEGCiKHe2LqWVfeAwA7xHQ@public.gmane.org>
2021-06-30 8:32 ` Michal Hocko
2021-06-30 8:32 ` Michal Hocko
[not found] ` <YNwsAh5u2h34tGDb-2MMpYkNvuYDjFM9bn6wA6Q@public.gmane.org>
2021-07-07 15:10 ` Matthew Wilcox
2021-07-07 15:10 ` Matthew Wilcox
[not found] ` <YOXD+TVkAeWmjLxX-FZi0V3Vbi30CUdFEqe4BF2D2FQJk+8+b@public.gmane.org>
2021-07-08 7:28 ` Michal Hocko
2021-07-08 7:28 ` Michal Hocko
2021-07-07 17:08 ` Johannes Weiner
2021-07-07 17:08 ` Johannes Weiner
[not found] ` <YOXfozcU8M/x2RQ4-druUgvl0LCNAfugRpC6u6w@public.gmane.org>
2021-07-07 19:28 ` Matthew Wilcox
2021-07-07 19:28 ` Matthew Wilcox
[not found] ` <YOYAZ5+xDFK0Slc8-FZi0V3Vbi30CUdFEqe4BF2D2FQJk+8+b@public.gmane.org>
2021-07-07 20:41 ` Johannes Weiner
2021-07-07 20:41 ` Johannes Weiner
[not found] ` <YOYRYXATm2gHoGGq-druUgvl0LCNAfugRpC6u6w@public.gmane.org>
2021-07-09 19:37 ` Matthew Wilcox
2021-07-09 19:37 ` Matthew Wilcox
2021-06-30 4:00 ` [PATCH v3 14/18] mm/memcg: Convert mem_cgroup_move_account() to use a folio Matthew Wilcox (Oracle)
2021-06-30 4:00 ` Matthew Wilcox (Oracle)
[not found] ` <20210630040034.1155892-15-willy-wEGCiKHe2LqWVfeAwA7xHQ@public.gmane.org>
2021-06-30 8:30 ` Michal Hocko
2021-06-30 8:30 ` Michal Hocko
[not found] ` <YNwrrl6cn48t6w5B-2MMpYkNvuYDjFM9bn6wA6Q@public.gmane.org>
2021-06-30 11:22 ` Matthew Wilcox
2021-06-30 11:22 ` Matthew Wilcox
[not found] ` <YNxUCLt/scn1d5jQ-FZi0V3Vbi30CUdFEqe4BF2D2FQJk+8+b@public.gmane.org>
2021-06-30 12:20 ` Michal Hocko
2021-06-30 12:20 ` Michal Hocko
[not found] ` <YNxhlr4d7Nl0vCz0-2MMpYkNvuYDjFM9bn6wA6Q@public.gmane.org>
2021-06-30 12:31 ` Matthew Wilcox
2021-06-30 12:31 ` Matthew Wilcox
[not found] ` <YNxkFSGUoaSzZ/36-FZi0V3Vbi30CUdFEqe4BF2D2FQJk+8+b@public.gmane.org>
2021-06-30 12:45 ` Michal Hocko
2021-06-30 12:45 ` Michal Hocko
[not found] ` <YNxnbTNAeNB9Isie-2MMpYkNvuYDjFM9bn6wA6Q@public.gmane.org>
2021-07-07 15:25 ` Matthew Wilcox
2021-07-07 15:25 ` Matthew Wilcox
[not found] ` <YOXHU42efcFGF/D4-FZi0V3Vbi30CUdFEqe4BF2D2FQJk+8+b@public.gmane.org>
2021-07-08 7:30 ` Michal Hocko
2021-07-08 7:30 ` Michal Hocko
2021-06-30 4:00 ` [PATCH v3 15/18] mm/memcg: Add mem_cgroup_folio_lruvec() Matthew Wilcox (Oracle)
2021-06-30 4:00 ` Matthew Wilcox (Oracle)
[not found] ` <20210630040034.1155892-16-willy-wEGCiKHe2LqWVfeAwA7xHQ@public.gmane.org>
2021-06-30 8:12 ` kernel test robot
2021-06-30 8:12 ` kernel test robot
2021-06-30 8:12 ` kernel test robot
2021-06-30 19:18 ` Matthew Wilcox
2021-06-30 19:18 ` Matthew Wilcox
[not found] ` <YNzDiTFZpRgKY0CE-FZi0V3Vbi30CUdFEqe4BF2D2FQJk+8+b@public.gmane.org>
2021-06-30 21:21 ` Johannes Weiner [this message]
2021-06-30 21:21 ` Johannes Weiner
2021-06-30 4:00 ` [PATCH v3 16/18] mm/memcg: Add folio_lruvec_lock() and similar functions Matthew Wilcox (Oracle)
2021-06-30 4:00 ` Matthew Wilcox (Oracle)
[not found] ` <20210630040034.1155892-17-willy-wEGCiKHe2LqWVfeAwA7xHQ@public.gmane.org>
2021-06-30 8:36 ` Michal Hocko
2021-06-30 8:36 ` Michal Hocko
2021-06-30 4:00 ` [PATCH v3 17/18] mm/memcg: Add folio_lruvec_relock_irq() and folio_lruvec_relock_irqsave() Matthew Wilcox (Oracle)
2021-06-30 4:00 ` Matthew Wilcox (Oracle)
[not found] ` <20210630040034.1155892-18-willy-wEGCiKHe2LqWVfeAwA7xHQ@public.gmane.org>
2021-06-30 8:39 ` Michal Hocko
2021-06-30 8:39 ` Michal Hocko
2021-06-30 4:00 ` [PATCH v3 18/18] mm/workingset: Convert workingset_activation to take a folio Matthew Wilcox (Oracle)
2021-06-30 4:00 ` Matthew Wilcox (Oracle)
2021-06-30 8:44 ` [PATCH v3 00/18] Folio conversion of memcg Michal Hocko
2021-06-30 8:44 ` Michal Hocko
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=YNzgSOkl77FHdfhV@cmpxchg.org \
--to=hannes-druugvl0lcnafugrpc6u6w@public.gmane.org \
--cc=cgroups-u79uwXL29TY76Z2rM5mHXA@public.gmane.org \
--cc=linux-mm-Bw31MaZKKs3YtjvyW6yDsg@public.gmane.org \
--cc=mhocko-DgEjT+Ai2ygdnm+yROfE0A@public.gmane.org \
--cc=vdavydov.dev-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org \
--cc=willy-wEGCiKHe2LqWVfeAwA7xHQ@public.gmane.org \
/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.