Re: [PATCH 2/2] mm: protect si_meminfo() and si_meminfo_node() from memory hotplug operations

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Sun, 17 Feb 2013, Jiang Liu wrote:

> There's typical usage of si_meminfo as below:
> 	si_meminfo(&si);
> 	threshold = si->totalram - si.totalhigh;
> 
> It may cause underflow if memory hotplug races with si_meminfo() because
> there's no mechanism to protect si_meminfo() from memory hotplug
> operations. And some callers expects that si_meminfo() is a lightweight
> operations. So introduce a lightweight mechanism to protect si_meminfo()
> from memory hotplug operations.
> 

Instead of this, I think it would be appropriate to add a comment that 
requires synchronization if two fields are going to be compared, i.e. use 
{lock,unlock}_memory_hotplug() in the caller to si_meminfo(), or 
appropriate underflow checking is done upon return.

--
To unsubscribe, send a message with 'unsubscribe linux-mm' in
the body to majordomo@xxxxxxxxx.  For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"dont@xxxxxxxxx";> email@xxxxxxxxx </a>


[Index of Archives]     [Linux ARM Kernel]     [Linux ARM]     [Linux Omap]     [Fedora ARM]     [IETF Annouce]     [Bugtraq]     [Linux]     [Linux OMAP]     [Linux MIPS]     [ECOS]     [Asterisk Internet PBX]     [Linux API]