93 lines
2.7 KiB
Diff
93 lines
2.7 KiB
Diff
|
From 9c2b8224f55a5fe2570179aaf8e0adaa9aba2a8a Mon Sep 17 00:00:00 2001
|
||
|
From: Sebastian Andrzej Siewior <bigeasy@linutronix.de>
|
||
|
Date: Wed, 28 Jan 2015 17:14:16 +0100
|
||
|
Subject: [PATCH 112/365] mm/memcontrol: Replace local_irq_disable with local
|
||
|
locks
|
||
|
|
||
|
There are a few local_irq_disable() which then take sleeping locks. This
|
||
|
patch converts them local locks.
|
||
|
|
||
|
Change-Id: I4933c66fcd9a5d95e0d1469dcb855875181e70ec
|
||
|
Signed-off-by: Sebastian Andrzej Siewior <bigeasy@linutronix.de>
|
||
|
---
|
||
|
mm/memcontrol.c | 16 ++++++++++++----
|
||
|
1 file changed, 12 insertions(+), 4 deletions(-)
|
||
|
|
||
|
diff --git a/mm/memcontrol.c b/mm/memcontrol.c
|
||
|
index da6d0b53a347..9d5048313e2f 100644
|
||
|
--- a/mm/memcontrol.c
|
||
|
+++ b/mm/memcontrol.c
|
||
|
@@ -67,6 +67,7 @@
|
||
|
#include <net/sock.h>
|
||
|
#include <net/ip.h>
|
||
|
#include "slab.h"
|
||
|
+#include <linux/locallock.h>
|
||
|
|
||
|
#include <asm/uaccess.h>
|
||
|
|
||
|
@@ -92,6 +93,8 @@ int do_swap_account __read_mostly;
|
||
|
#define do_swap_account 0
|
||
|
#endif
|
||
|
|
||
|
+static DEFINE_LOCAL_IRQ_LOCK(event_lock);
|
||
|
+
|
||
|
/* Whether legacy memory+swap accounting is active */
|
||
|
static bool do_memsw_account(void)
|
||
|
{
|
||
|
@@ -4618,12 +4621,12 @@ static int mem_cgroup_move_account(struct page *page,
|
||
|
|
||
|
ret = 0;
|
||
|
|
||
|
- local_irq_disable();
|
||
|
+ local_lock_irq(event_lock);
|
||
|
mem_cgroup_charge_statistics(to, page, compound, nr_pages);
|
||
|
memcg_check_events(to, page);
|
||
|
mem_cgroup_charge_statistics(from, page, compound, -nr_pages);
|
||
|
memcg_check_events(from, page);
|
||
|
- local_irq_enable();
|
||
|
+ local_unlock_irq(event_lock);
|
||
|
out_unlock:
|
||
|
unlock_page(page);
|
||
|
out:
|
||
|
@@ -5526,10 +5529,10 @@ void mem_cgroup_commit_charge(struct page *page, struct mem_cgroup *memcg,
|
||
|
|
||
|
commit_charge(page, memcg, lrucare);
|
||
|
|
||
|
- local_irq_disable();
|
||
|
+ local_lock_irq(event_lock);
|
||
|
mem_cgroup_charge_statistics(memcg, page, compound, nr_pages);
|
||
|
memcg_check_events(memcg, page);
|
||
|
- local_irq_enable();
|
||
|
+ local_unlock_irq(event_lock);
|
||
|
|
||
|
if (do_memsw_account() && PageSwapCache(page)) {
|
||
|
swp_entry_t entry = { .val = page_private(page) };
|
||
|
@@ -5962,6 +5965,7 @@ void mem_cgroup_swapout(struct page *page, swp_entry_t entry)
|
||
|
{
|
||
|
struct mem_cgroup *memcg, *swap_memcg;
|
||
|
unsigned short oldid;
|
||
|
+ unsigned long flags;
|
||
|
|
||
|
VM_BUG_ON_PAGE(PageLRU(page), page);
|
||
|
VM_BUG_ON_PAGE(page_count(page), page);
|
||
|
@@ -6002,12 +6006,16 @@ void mem_cgroup_swapout(struct page *page, swp_entry_t entry)
|
||
|
* important here to have the interrupts disabled because it is the
|
||
|
* only synchronisation we have for udpating the per-CPU variables.
|
||
|
*/
|
||
|
+ local_lock_irqsave(event_lock, flags);
|
||
|
+#ifndef CONFIG_PREEMPT_RT_BASE
|
||
|
VM_BUG_ON(!irqs_disabled());
|
||
|
+#endif
|
||
|
mem_cgroup_charge_statistics(memcg, page, false, -1);
|
||
|
memcg_check_events(memcg, page);
|
||
|
|
||
|
if (!mem_cgroup_is_root(memcg))
|
||
|
css_put(&memcg->css);
|
||
|
+ local_unlock_irqrestore(event_lock, flags);
|
||
|
}
|
||
|
|
||
|
/*
|
||
|
--
|
||
|
2.28.0
|
||
|
|