diff options
author | Michal Hocko <mhocko@suse.cz> | 2013-07-31 16:53:48 -0400 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2013-07-31 17:41:03 -0400 |
commit | 22f2020f84c6da2dd0acb2dce12e39e59ff7c8be (patch) | |
tree | 34188bc4df41de78fbbc4c45c8b913ea8f7f7761 /mm/vmpressure.c | |
parent | 62e32ac3505a0cab1c5ef8ea2c0eab3b26ed855f (diff) |
vmpressure: change vmpressure::sr_lock to spinlock
There is nothing that can sleep inside critical sections protected by
this lock and those sections are really small so there doesn't make much
sense to use mutex for them. Change the log to a spinlock
Signed-off-by: Michal Hocko <mhocko@suse.cz>
Reported-by: Tejun Heo <tj@kernel.org>
Cc: Anton Vorontsov <anton.vorontsov@linaro.org>
Cc: Johannes Weiner <hannes@cmpxchg.org>
Cc: KAMEZAWA Hiroyuki <kamezawa.hiroyu@jp.fujitsu.com>
Cc: KOSAKI Motohiro <kosaki.motohiro@jp.fujitsu.com>
Cc: Li Zefan <lizefan@huawei.com>
Reviewed-by: Tejun Heo <tj@kernel.org>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Diffstat (limited to 'mm/vmpressure.c')
-rw-r--r-- | mm/vmpressure.c | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/mm/vmpressure.c b/mm/vmpressure.c index 736a6011c2c8..f4ee6a190a4d 100644 --- a/mm/vmpressure.c +++ b/mm/vmpressure.c | |||
@@ -180,12 +180,12 @@ static void vmpressure_work_fn(struct work_struct *work) | |||
180 | if (!vmpr->scanned) | 180 | if (!vmpr->scanned) |
181 | return; | 181 | return; |
182 | 182 | ||
183 | mutex_lock(&vmpr->sr_lock); | 183 | spin_lock(&vmpr->sr_lock); |
184 | scanned = vmpr->scanned; | 184 | scanned = vmpr->scanned; |
185 | reclaimed = vmpr->reclaimed; | 185 | reclaimed = vmpr->reclaimed; |
186 | vmpr->scanned = 0; | 186 | vmpr->scanned = 0; |
187 | vmpr->reclaimed = 0; | 187 | vmpr->reclaimed = 0; |
188 | mutex_unlock(&vmpr->sr_lock); | 188 | spin_unlock(&vmpr->sr_lock); |
189 | 189 | ||
190 | do { | 190 | do { |
191 | if (vmpressure_event(vmpr, scanned, reclaimed)) | 191 | if (vmpressure_event(vmpr, scanned, reclaimed)) |
@@ -240,11 +240,11 @@ void vmpressure(gfp_t gfp, struct mem_cgroup *memcg, | |||
240 | if (!scanned) | 240 | if (!scanned) |
241 | return; | 241 | return; |
242 | 242 | ||
243 | mutex_lock(&vmpr->sr_lock); | 243 | spin_lock(&vmpr->sr_lock); |
244 | vmpr->scanned += scanned; | 244 | vmpr->scanned += scanned; |
245 | vmpr->reclaimed += reclaimed; | 245 | vmpr->reclaimed += reclaimed; |
246 | scanned = vmpr->scanned; | 246 | scanned = vmpr->scanned; |
247 | mutex_unlock(&vmpr->sr_lock); | 247 | spin_unlock(&vmpr->sr_lock); |
248 | 248 | ||
249 | if (scanned < vmpressure_win || work_pending(&vmpr->work)) | 249 | if (scanned < vmpressure_win || work_pending(&vmpr->work)) |
250 | return; | 250 | return; |
@@ -367,7 +367,7 @@ void vmpressure_unregister_event(struct cgroup *cg, struct cftype *cft, | |||
367 | */ | 367 | */ |
368 | void vmpressure_init(struct vmpressure *vmpr) | 368 | void vmpressure_init(struct vmpressure *vmpr) |
369 | { | 369 | { |
370 | mutex_init(&vmpr->sr_lock); | 370 | spin_lock_init(&vmpr->sr_lock); |
371 | mutex_init(&vmpr->events_lock); | 371 | mutex_init(&vmpr->events_lock); |
372 | INIT_LIST_HEAD(&vmpr->events); | 372 | INIT_LIST_HEAD(&vmpr->events); |
373 | INIT_WORK(&vmpr->work, vmpressure_work_fn); | 373 | INIT_WORK(&vmpr->work, vmpressure_work_fn); |