[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <31cab57d-6e79-33cb-1a58-99065c6e7b82@yandex-team.ru>
Date: Tue, 15 Oct 2019 13:49:14 +0300
From: Konstantin Khlebnikov <khlebnikov@...dex-team.ru>
To: Michal Hocko <mhocko@...nel.org>
Cc: linux-mm@...ck.org, Andrew Morton <akpm@...ux-foundation.org>,
linux-kernel@...r.kernel.org, cgroups@...r.kernel.org,
Vladimir Davydov <vdavydov.dev@...il.com>,
Johannes Weiner <hannes@...xchg.org>
Subject: Re: [PATCH] mm/memcontrol: update lruvec counters in
mem_cgroup_move_account
On 15/10/2019 13.36, Michal Hocko wrote:
> On Tue 15-10-19 11:44:22, Konstantin Khlebnikov wrote:
>> On 15/10/2019 11.20, Michal Hocko wrote:
>>> On Tue 15-10-19 11:09:59, Konstantin Khlebnikov wrote:
>>>> Mapped, dirty and writeback pages are also counted in per-lruvec stats.
>>>> These counters needs update when page is moved between cgroups.
>>>
>>> Please describe the user visible effect.
>>
>> Surprisingly I don't see any users at this moment.
>> So, there is no effect in mainline kernel.
>
> Those counters are exported right? Or do we exclude them for v1?
It seems per-lruvec statistics is not exposed anywhere.
And per-lruvec NR_FILE_MAPPED, NR_FILE_DIRTY, NR_WRITEBACK never had users.
I've found this because I'm using mem_cgroup_move_account for recharging
pages at mlock and playing right now with debug for memory cgroup which
validates statistics and counters when cgroup dies.
>
>>>> Fixes: 00f3ca2c2d66 ("mm: memcontrol: per-lruvec stats infrastructure")
>>>> Signed-off-by: Konstantin Khlebnikov <khlebnikov@...dex-team.ru>
>>>
>>> We want Cc: stable I suspect because broken stats might be really
>>> misleading.
>>>
>>> The patch looks ok to me otherwise
>>> Acked-by: Michal Hocko <mhocko@...e.com>
>>>
>>>> ---
>>>> mm/memcontrol.c | 18 ++++++++++++------
>>>> 1 file changed, 12 insertions(+), 6 deletions(-)
>>>>
>>>> diff --git a/mm/memcontrol.c b/mm/memcontrol.c
>>>> index bdac56009a38..363106578876 100644
>>>> --- a/mm/memcontrol.c
>>>> +++ b/mm/memcontrol.c
>>>> @@ -5420,6 +5420,8 @@ static int mem_cgroup_move_account(struct page *page,
>>>> struct mem_cgroup *from,
>>>> struct mem_cgroup *to)
>>>> {
>>>> + struct lruvec *from_vec, *to_vec;
>>>> + struct pglist_data *pgdat;
>>>> unsigned long flags;
>>>> unsigned int nr_pages = compound ? hpage_nr_pages(page) : 1;
>>>> int ret;
>>>> @@ -5443,11 +5445,15 @@ static int mem_cgroup_move_account(struct page *page,
>>>> anon = PageAnon(page);
>>>> + pgdat = page_pgdat(page);
>>>> + from_vec = mem_cgroup_lruvec(pgdat, from);
>>>> + to_vec = mem_cgroup_lruvec(pgdat, to);
>>>> +
>>>> spin_lock_irqsave(&from->move_lock, flags);
>>>> if (!anon && page_mapped(page)) {
>>>> - __mod_memcg_state(from, NR_FILE_MAPPED, -nr_pages);
>>>> - __mod_memcg_state(to, NR_FILE_MAPPED, nr_pages);
>>>> + __mod_lruvec_state(from_vec, NR_FILE_MAPPED, -nr_pages);
>>>> + __mod_lruvec_state(to_vec, NR_FILE_MAPPED, nr_pages);
>>>> }
>>>> /*
>>>> @@ -5459,14 +5465,14 @@ static int mem_cgroup_move_account(struct page *page,
>>>> struct address_space *mapping = page_mapping(page);
>>>> if (mapping_cap_account_dirty(mapping)) {
>>>> - __mod_memcg_state(from, NR_FILE_DIRTY, -nr_pages);
>>>> - __mod_memcg_state(to, NR_FILE_DIRTY, nr_pages);
>>>> + __mod_lruvec_state(from_vec, NR_FILE_DIRTY, -nr_pages);
>>>> + __mod_lruvec_state(to_vec, NR_FILE_DIRTY, nr_pages);
>>>> }
>>>> }
>>>> if (PageWriteback(page)) {
>>>> - __mod_memcg_state(from, NR_WRITEBACK, -nr_pages);
>>>> - __mod_memcg_state(to, NR_WRITEBACK, nr_pages);
>>>> + __mod_lruvec_state(from_vec, NR_WRITEBACK, -nr_pages);
>>>> + __mod_lruvec_state(to_vec, NR_WRITEBACK, nr_pages);
>>>> }
>>>> #ifdef CONFIG_TRANSPARENT_HUGEPAGE
>>>
>
Powered by blists - more mailing lists