Subject: Re: [PATCH 01/14] mm: Serialize access to min_free_kbytes

From: Mel Gorman <[email-masked]>
Date: Thu, 7 Jul 2011 10:17:44 +0100

On Wed, Jul 06, 2011 at 04:44:47PM -0700, Andrew Morton wrote:
> On Mon, 20 Jun 2011 14:12:07 +0100
> Mel Gorman <[email-masked]> wrote:
> 
> > There is a race between the min_free_kbytes sysctl, memory hotplug
> > and transparent hugepage support enablement.  Memory hotplug uses a
> > zonelists_mutex to avoid a race when building zonelists. Reuse it to
> > serialise watermark updates.
> 
> This patch appears to be a standalone fix, unrelated to the overall
> patch series?
> 

Yes. In the original series this would have been a more serious problem
as min_free_kbytes was potentially adjusted more frequently.

> How does one trigger the race and what happens when it hits, btw?

One could trigger the trace by having multiple processes on different
CPUs write to min_free_kbytes. One could add memory hotplug events
to that for extra fun but it is unnecessary to trigger the race.

The consequences are that the value for min_free_kbytes and the zone
watermarks get out of sync. Whether the zone watermarks will be too
high or too low would depend on the timing. For the most part, the
consequence will simply be that the min free level for some zones will
be wrong. A more serious consequence is that totalreserve_pages could
get out of sync and strict no memory overcommit could fail a mmap when
it should have succeeded for the value of min_free_kbytes or suspend
fail because it did not preallocate enough pages.

It's not exactly earth shattering.

-- 
Mel Gorman
SUSE Labs

--
To unsubscribe, send a message with 'unsubscribe linux-mm' in
the body to [email-masked].  For more info on Linux MM,
see: http://www.linux-mm.org/ .
Fight unfair telecom internet charges in Canada: sign http://stopthemeter.ca/
Don't email: <a href=mailto:"[email-masked]"> [email-masked] </a>