lkml.org 
[lkml]   [2011]   [Apr]   [26]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [PATCH 12/13] mm: Throttle direct reclaimers if PF_MEMALLOC reserves are low and swap is backed by network storage
On Tue, 26 Apr 2011 08:36:53 +0100 Mel Gorman <mgorman@suse.de> wrote:


> +/*
> + * Throttle direct reclaimers if backing storage is backed by the network
> + * and the PFMEMALLOC reserve for the preferred node is getting dangerously
> + * depleted. kswapd will continue to make progress and wake the processes
> + * when the low watermark is reached
> + */
> +static void throttle_direct_reclaim(gfp_t gfp_mask, struct zonelist *zonelist,
> + nodemask_t *nodemask)
> +{
> + struct zone *zone;
> + int high_zoneidx = gfp_zone(gfp_mask);
> + DEFINE_WAIT(wait);
> +
> + /* Check if the pfmemalloc reserves are ok */
> + first_zones_zonelist(zonelist, high_zoneidx, NULL, &zone);
> + prepare_to_wait(&zone->zone_pgdat->pfmemalloc_wait, &wait,
> + TASK_INTERRUPTIBLE);
> + if (pfmemalloc_watermark_ok(zone->zone_pgdat, high_zoneidx))
> + goto out;
> +
> + /* Throttle */
> + do {
> + schedule();
> + finish_wait(&zone->zone_pgdat->pfmemalloc_wait, &wait);
> + prepare_to_wait(&zone->zone_pgdat->pfmemalloc_wait, &wait,
> + TASK_INTERRUPTIBLE);
> + } while (!pfmemalloc_watermark_ok(zone->zone_pgdat, high_zoneidx) &&
> + !fatal_signal_pending(current));
> +
> +out:
> + finish_wait(&zone->zone_pgdat->pfmemalloc_wait, &wait);
> +}

You are doing an interruptible wait, but only checking for fatal signals.
So if a non-fatal signal arrives, you will busy-wait.

So I suspect you want TASK_KILLABLE, so just use:

wait_event_killable(zone->zone_pgdat->pfmemalloc_wait,
pgmemalloc_watermark_ok(zone->zone_pgdata,
high_zoneidx));

(You also have an extraneous call to finish_wait)

NeilBrown




\
 
 \ /
  Last update: 2011-04-26 14:33    [W:0.150 / U:1.380 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site