From: Michal Hocko <mhocko@suse.com>
To: Kirill Tkhai <ktkhai@virtuozzo.com>
Cc: Baoquan He <bhe@redhat.com>,
Daniel Jordan <daniel.m.jordan@oracle.com>,
akpm@linux-foundation.org, hannes@cmpxchg.org, dave@stgolabs.net,
linux-mm@kvack.org
Subject: Re: [PATCH v2] mm: Simplify shrink_inactive_list()
Date: Fri, 12 Apr 2019 14:05:04 +0200 [thread overview]
Message-ID: <20190412120504.GD5223@dhcp22.suse.cz> (raw)
In-Reply-To: <4ac7242c-54d3-cd44-2cd9-5d5c746e2690@virtuozzo.com>
On Fri 12-04-19 14:33:27, Kirill Tkhai wrote:
> On 12.04.2019 14:31, Michal Hocko wrote:
> > On Fri 12-04-19 13:55:59, Kirill Tkhai wrote:
> >> This merges together duplicating patterns of code.
> >
> > OK, this looks better than the previous version
> >
> >> Also, replace count_memcg_events() with its
> >> irq-careless namesake.
> >
> > Why?
>
> Since interrupts are already disabled, and there is
> no a sense to disable them twice.
right and changelog could have mentioned that...
> >> Signed-off-by: Kirill Tkhai <ktkhai@virtuozzo.com>
Anyway, forgot to add
Acked-by: Michal Hocko <mhocko@suse.com>
> >>
> >> v2: Introduce local variable.
> >> ---
> >> mm/vmscan.c | 31 +++++++++----------------------
> >> 1 file changed, 9 insertions(+), 22 deletions(-)
> >>
> >> diff --git a/mm/vmscan.c b/mm/vmscan.c
> >> index 836b28913bd7..d96efff59a11 100644
> >> --- a/mm/vmscan.c
> >> +++ b/mm/vmscan.c
> >> @@ -1907,6 +1907,7 @@ shrink_inactive_list(unsigned long nr_to_scan, struct lruvec *lruvec,
> >> unsigned long nr_taken;
> >> struct reclaim_stat stat;
> >> int file = is_file_lru(lru);
> >> + enum vm_event_item item;
> >> struct pglist_data *pgdat = lruvec_pgdat(lruvec);
> >> struct zone_reclaim_stat *reclaim_stat = &lruvec->reclaim_stat;
> >> bool stalled = false;
> >> @@ -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);
> >> - }
> >> + item = current_is_kswapd() ? PGSCAN_KSWAPD : PGSCAN_DIRECT;
> >> + if (global_reclaim(sc))
> >> + __count_vm_events(item, nr_scanned);
> >> + __count_memcg_events(lruvec_memcg(lruvec), item, nr_scanned);
> >> spin_unlock_irq(&pgdat->lru_lock);
> >>
> >> if (nr_taken == 0)
> >> @@ -1955,17 +1949,10 @@ shrink_inactive_list(unsigned long nr_to_scan, struct lruvec *lruvec,
> >>
> >> spin_lock_irq(&pgdat->lru_lock);
> >>
> >> - if (current_is_kswapd()) {
> >> - if (global_reclaim(sc))
> >> - __count_vm_events(PGSTEAL_KSWAPD, nr_reclaimed);
> >> - count_memcg_events(lruvec_memcg(lruvec), PGSTEAL_KSWAPD,
> >> - nr_reclaimed);
> >> - } else {
> >> - if (global_reclaim(sc))
> >> - __count_vm_events(PGSTEAL_DIRECT, nr_reclaimed);
> >> - count_memcg_events(lruvec_memcg(lruvec), PGSTEAL_DIRECT,
> >> - nr_reclaimed);
> >> - }
> >> + item = current_is_kswapd() ? PGSTEAL_KSWAPD : PGSTEAL_DIRECT;
> >> + if (global_reclaim(sc))
> >> + __count_vm_events(item, nr_reclaimed);
> >> + __count_memcg_events(lruvec_memcg(lruvec), item, nr_reclaimed);
> >> reclaim_stat->recent_rotated[0] = stat.nr_activate[0];
> >> reclaim_stat->recent_rotated[1] = stat.nr_activate[1];
> >>
> >
>
--
Michal Hocko
SUSE Labs
next prev parent reply other threads:[~2019-04-12 12:05 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-04-10 15:07 [PATCH] " Kirill Tkhai
2019-04-11 22:13 ` Daniel Jordan
2019-04-12 0:05 ` Baoquan He
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 [this message]
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=20190412120504.GD5223@dhcp22.suse.cz \
--to=mhocko@suse.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=ktkhai@virtuozzo.com \
--cc=linux-mm@kvack.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox