linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
From: Konstantin Khlebnikov <khlebnikov@yandex-team.ru>
To: Michal Hocko <mhocko@kernel.org>
Cc: linux-mm@kvack.org, Andrew Morton <akpm@linux-foundation.org>,
	linux-kernel@vger.kernel.org, cgroups@vger.kernel.org,
	Vladimir Davydov <vdavydov.dev@gmail.com>,
	Johannes Weiner <hannes@cmpxchg.org>
Subject: Re: [PATCH] mm/memcontrol: update lruvec counters in mem_cgroup_move_account
Date: Tue, 15 Oct 2019 11:44:22 +0300	[thread overview]
Message-ID: <3b73e301-ea4a-5edb-9360-2ae9b4ad9f69@yandex-team.ru> (raw)
In-Reply-To: <20191015082048.GU317@dhcp22.suse.cz>

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.

>> Fixes: 00f3ca2c2d66 ("mm: memcontrol: per-lruvec stats infrastructure")
>> Signed-off-by: Konstantin Khlebnikov <khlebnikov@yandex-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@suse.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
> 


  reply	other threads:[~2019-10-15  8:44 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-10-15  8:09 Konstantin Khlebnikov
2019-10-15  8:20 ` Michal Hocko
2019-10-15  8:44   ` Konstantin Khlebnikov [this message]
2019-10-15 10:36     ` Michal Hocko
2019-10-15 10:49       ` Konstantin Khlebnikov
2019-10-15 11:04         ` Michal Hocko
2019-10-15 14:31           ` Johannes Weiner
2019-10-16  8:25             ` Konstantin Khlebnikov
2019-10-15 13:53 ` Johannes Weiner
2019-10-15 14:04   ` Konstantin Khlebnikov
2019-10-15 15:24     ` Johannes Weiner

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=3b73e301-ea4a-5edb-9360-2ae9b4ad9f69@yandex-team.ru \
    --to=khlebnikov@yandex-team.ru \
    --cc=akpm@linux-foundation.org \
    --cc=cgroups@vger.kernel.org \
    --cc=hannes@cmpxchg.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mm@kvack.org \
    --cc=mhocko@kernel.org \
    --cc=vdavydov.dev@gmail.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox