Bug 88051 - vmpressure_work_fn is not multi-thread safe
Summary: vmpressure_work_fn is not multi-thread safe
Status: RESOLVED CODE_FIX
Alias: None
Product: Memory Management
Classification: Unclassified
Component: Other (show other bugs)
Hardware: All Linux
: P1 high
Assignee: Andrew Morton
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2014-11-11 16:47 UTC by ji_ang
Modified: 2014-11-19 21:21 UTC (History)
0 users

See Also:
Kernel Version: 3.18-rc4 and all earlier versions
Subsystem:
Regression: No
Bisected commit-id:


Attachments

Description ji_ang 2014-11-11 16:47:58 UTC
static void vmpressure_work_fn(struct work_struct *work)
{
 ...
	if (!vmpr->scanned)
		return;

	spin_lock(&vmpr->sr_lock);
	scanned = vmpr->scanned;

In some android devices, there will be a "divided by zero" expection. the vmpr->scanned could be zero before “spin_lock(&vmpr->sr_lock)”

So the above source code should be changed to:

	spin_lock(&vmpr->sr_lock);
	scanned = vmpr->scanned;
	if (!scanned)
	{
		spin_unlock(&vmpr->sr_lock);
		return;
	}
Comment 1 Andrew Morton 2014-11-19 21:21:50 UTC
Thanks, I queued that fix.

Note You need to log in before you can comment on or make changes to this bug.