lkml.org 
[lkml]   [2016]   [Jul]   [5]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [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

\
 
 \ /
  Last update: 2016-07-05 13:01    [W:0.087 / U:34.216 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site