lkml.org 
[lkml]   [2013]   [Apr]   [8]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [PATCH v4, part3 11/15] mm: use a dedicated lock to protect totalram_pages and zone->managed_pages
On 04/08/2013 09:39 PM, Rik van Riel wrote:
> On 04/06/2013 09:55 AM, Jiang Liu wrote:
>
>> @@ -5186,6 +5189,22 @@ early_param("movablecore", cmdline_parse_movablecore);
>>
>> #endif /* CONFIG_HAVE_MEMBLOCK_NODE_MAP */
>>
>> +void adjust_managed_page_count(struct page *page, long count)
>> +{
>> + bool lock = (system_state != SYSTEM_BOOTING);
>> +
>> + /* No need to acquire the lock during boot */
>> + if (lock)
>> + spin_lock(&managed_page_count_lock);
>> +
>> + page_zone(page)->managed_pages += count;
>> + totalram_pages += count;
>> +
>> + if (lock)
>> + spin_unlock(&managed_page_count_lock);
>> +}
>
> While I agree the boot code currently does not need the lock, is
> there any harm to removing that conditional?
>
> That would simplify the code, and protect against possible future
> cleverness of initializing multiple memory things simultaneously.
>
Hi Rik,
Thanks for you comments.
I'm OK with that. Acquiring/releasing the lock should be lightweight
because there shouldn't be contention during boot. Will remove the logic in
next version.
Regards!
Gerry


\
 
 \ /
  Last update: 2013-04-08 19:01    [W:0.041 / U:0.952 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site