Re: [PATCH 08/27] mm, vmscan: Simplify the logic deciding whether kswapd sleeps

Mel Gorman
2016-06-16T09:17:05Z

On Thu, Jun 16, 2016 at 09:30:33AM +0100, Mel Gorman wrote:
> > >@@ -2727,7 +2727,7 @@ static bool pfmemalloc_watermark_ok(pg_data_t *pgdat)
> > >
> > > /* kswapd must be awake if processes are being throttled */
> > > if (!wmark_ok && waitqueue_active(&pgdat->kswapd_wait)) {
> > >- pgdat->classzone_idx = min(pgdat->classzone_idx,
> > >+ pgdat->kswapd_classzone_idx = min(pgdat->kswapd_classzone_idx,
> > > (enum zone_type)ZONE_NORMAL);
> > > wake_up_interruptible(&pgdat->kswapd_wait);
> > > }
> > >@@ -3211,6 +3211,12 @@ 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 full sleep */
> > >+ if (classzone_idx == -1) {
> > >+ classzone_idx = balanced_classzone_idx = MAX_NR_ZONES - 1;
> > >+ goto full_sleep;
> >
> > This will skip the wakeup_kcompactd() part.
> >
>
> I wrestled with this one. I decided to leave it alone on the grounds
> that if kswapd has not been woken recently then compaction efforts also
> have not failed and kcompactd is not required.
>

And I was wrong. There needs to be a call to wakeup_kcompactd there to
cover the case where there was a single high-order allocation request
that failed and woke kswapd.

--
Mel Gorman
SUSE Labs