[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20160705102639.GG11498@techsingularity.net>
Date: Tue, 5 Jul 2016 11:26:39 +0100
From: Mel Gorman <mgorman@...hsingularity.net>
To: Minchan Kim <minchan@...nel.org>
Cc: Andrew Morton <akpm@...ux-foundation.org>,
Linux-MM <linux-mm@...ck.org>, Rik van Riel <riel@...riel.com>,
Vlastimil Babka <vbabka@...e.cz>,
Johannes Weiner <hannes@...xchg.org>,
LKML <linux-kernel@...r.kernel.org>
Subject: Re: [PATCH 08/31] mm, vmscan: simplify the logic deciding whether
kswapd sleeps
On Tue, Jul 05, 2016 at 02:59:31PM +0900, Minchan Kim wrote:
> > @@ -3249,9 +3249,19 @@ static void kswapd_try_to_sleep(pg_data_t *pgdat, int order,
> >
> > prepare_to_wait(&pgdat->kswapd_wait, &wait, TASK_INTERRUPTIBLE);
> >
> > + /*
> > + * If kswapd has not been woken recently, then kswapd goes fully
> > + * to sleep. kcompactd may still need to wake if the original
> > + * request was high-order.
> > + */
> > + if (classzone_idx == -1) {
> > + wakeup_kcompactd(pgdat, alloc_order, classzone_idx);
> > + classzone_idx = MAX_NR_ZONES - 1;
> > + goto full_sleep;
> > + }
> > +
> > /* Try to sleep for a short interval */
> > - if (prepare_kswapd_sleep(pgdat, order, remaining,
> > - balanced_classzone_idx)) {
> > + if (prepare_kswapd_sleep(pgdat, reclaim_order, remaining, classzone_idx)) {
>
>
> Just trivial but this is clean up patch so I suggest one.
> If it doesn't help readability, just ignore, please.
>
> This(ie, first prepare_kswapd_sleep always get 0 remaining value so
> it's pointless argument for the function. We could remove it and
> check it before second prepare_kswapd_sleep call.
>
Yeah, fair point. I added a new patch that does this near the end of
the series with the other patches that avoid unnecessarily passing
parameters.
> > @@ -3418,10 +3426,10 @@ void wakeup_kswapd(struct zone *zone, int order, enum zone_type classzone_idx)
> > if (!cpuset_zone_allowed(zone, GFP_KERNEL | __GFP_HARDWALL))
> > return;
> > pgdat = zone->zone_pgdat;
> > - if (pgdat->kswapd_max_order < order) {
> > - pgdat->kswapd_max_order = order;
> > - pgdat->classzone_idx = min(pgdat->classzone_idx, classzone_idx);
> > - }
> > + if (pgdat->kswapd_classzone_idx == -1)
> > + pgdat->kswapd_classzone_idx = classzone_idx;
>
> It's tricky. Couldn't we change kswapd_classzone_idx to integer type
> and remove if above if condition?
>
It's tricky and not necessarily better overall. It's perfectly possible
to be woken up for zone index 0 so it's changing -1 to another magic
value.
--
Mel Gorman
SUSE Labs
Powered by blists - more mailing lists