All of lore.kernel.org
 help / color / mirror / Atom feed
From: Kirill Tkhai <ktkhai@virtuozzo.com>
To: Baoquan He <bhe@redhat.com>, Daniel Jordan <daniel.m.jordan@oracle.com>
Cc: akpm@linux-foundation.org, mhocko@suse.com, hannes@cmpxchg.org,
	dave@stgolabs.net, linux-mm@kvack.org
Subject: Re: [PATCH] mm: Simplify shrink_inactive_list()
Date: Fri, 12 Apr 2019 13:52:08 +0300	[thread overview]
Message-ID: <2108955f-af24-2772-baa2-69d1935773c8@virtuozzo.com> (raw)
In-Reply-To: <20190412000547.GB3856@localhost.localdomain>

On 12.04.2019 03:05, Baoquan He wrote:
> On 04/11/19 at 06:13pm, Daniel Jordan wrote:
>> On Wed, Apr 10, 2019 at 06:07:04PM +0300, Kirill Tkhai wrote:
>>> @@ -1934,17 +1935,10 @@ shrink_inactive_list(unsigned long nr_to_scan, struct lruvec *lruvec,
>>>  	__mod_node_page_state(pgdat, NR_ISOLATED_ANON + file, nr_taken);
>>>  	reclaim_stat->recent_scanned[file] += nr_taken;
>>>  
>>> -	if (current_is_kswapd()) {
>>> -		if (global_reclaim(sc))
>>> -			__count_vm_events(PGSCAN_KSWAPD, nr_scanned);
>>> -		count_memcg_events(lruvec_memcg(lruvec), PGSCAN_KSWAPD,
>>> -				   nr_scanned);
>>> -	} else {
>>> -		if (global_reclaim(sc))
>>> -			__count_vm_events(PGSCAN_DIRECT, nr_scanned);
>>> -		count_memcg_events(lruvec_memcg(lruvec), PGSCAN_DIRECT,
>>> -				   nr_scanned);
>>> -	}
>>> +	if (global_reclaim(sc))
>>> +		__count_vm_events(PGSCAN_KSWAPD + is_direct, nr_scanned);
>>> +	__count_memcg_events(lruvec_memcg(lruvec), PGSCAN_KSWAPD + is_direct,
>>> +			     nr_scanned);
>>
>> Nice to avoid duplication like this, but now it takes looking at
>> vm_event_item.h to understand that (PGSCAN_KSWAPD + is_direct) might mean
>> PGSCAN_DIRECT.
>>
>> What about this pattern for each block instead, which makes the stat used
>> explicit and avoids the header change?
>>
>>        stat = current_is_kswapd() ? PG*_KSWAPD : PG*_DIRECT;
> 
> Yeah, looks nice. Maybe name it as item or event since we have had stat
> locally defined as "struct reclaim_stat stat".
> 
> 	enum vm_event_item item;
> 	...
>         item = current_is_kswapd() ? PG*_KSWAPD : PG*_DIRECT;

Sounds good.


  reply	other threads:[~2019-04-12 10:52 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-04-10 15:07 [PATCH] mm: Simplify shrink_inactive_list() Kirill Tkhai
2019-04-11 22:13 ` Daniel Jordan
2019-04-12  0:05   ` Baoquan He
2019-04-12 10:52     ` Kirill Tkhai [this message]
2019-04-12 10:55     ` [PATCH v2] " Kirill Tkhai
2019-04-12 11:31       ` Michal Hocko
2019-04-12 11:33         ` Kirill Tkhai
2019-04-12 12:05           ` Michal Hocko
2019-04-12 12:10             ` [PATCH v3] " Kirill Tkhai
2019-04-12 14:16               ` Daniel Jordan
2019-04-12 15:16               ` 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=2108955f-af24-2772-baa2-69d1935773c8@virtuozzo.com \
    --to=ktkhai@virtuozzo.com \
    --cc=akpm@linux-foundation.org \
    --cc=bhe@redhat.com \
    --cc=daniel.m.jordan@oracle.com \
    --cc=dave@stgolabs.net \
    --cc=hannes@cmpxchg.org \
    --cc=linux-mm@kvack.org \
    --cc=mhocko@suse.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.