linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
From: Baoquan He <bhe@redhat.com>
To: Daniel Jordan <daniel.m.jordan@oracle.com>
Cc: Kirill Tkhai <ktkhai@virtuozzo.com>,
	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 08:05:47 +0800	[thread overview]
Message-ID: <20190412000547.GB3856@localhost.localdomain> (raw)
In-Reply-To: <20190411221310.sz5jtsb563wlaj3v@ca-dmjordan1.us.oracle.com>

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;


  reply	other threads:[~2019-04-12  0:05 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-04-10 15:07 Kirill Tkhai
2019-04-11 22:13 ` Daniel Jordan
2019-04-12  0:05   ` Baoquan He [this message]
2019-04-12 10:52     ` Kirill Tkhai
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=20190412000547.GB3856@localhost.localdomain \
    --to=bhe@redhat.com \
    --cc=akpm@linux-foundation.org \
    --cc=daniel.m.jordan@oracle.com \
    --cc=dave@stgolabs.net \
    --cc=hannes@cmpxchg.org \
    --cc=ktkhai@virtuozzo.com \
    --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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox