lkml.org 
[lkml]   [2008]   [Dec]   [11]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
Patch in this message
/
From
Subject[PATCH] [RT] avoid preemption in memory controller code
Date
the lru_lock of struct mem_group_per_zone is used to avoid preemption
during the mem_cgroup_charge_statistics function. this does not work
correctly, when CONFIG_PREEMPT_RT is enabled.
therefore, the preemption is disabled using the preempt_disable_rt macro
in these cases.

Signed-off-by: Tim Blechmann <tim@klingt.org>
---
mm/memcontrol.c | 4 +++-
1 files changed, 3 insertions(+), 1 deletions(-)

diff --git a/mm/memcontrol.c b/mm/memcontrol.c
index 562b94f..70493c4 100644
--- a/mm/memcontrol.c
+++ b/mm/memcontrol.c
@@ -158,7 +158,7 @@ pcg_default_flags[NR_CHARGE_TYPE] = {
};

/*
- * Always modified under lru lock. Then, not necessary to preempt_disable()
+ * Always modified under lru lock. Disable preemption with preempt_disable_rt()
*/
static void mem_cgroup_charge_statistics(struct mem_cgroup *mem,
struct page_cgroup *pc,
@@ -170,6 +170,7 @@ static void mem_cgroup_charge_statistics(struct mem_cgroup *mem,

VM_BUG_ON(!irqs_disabled());

+ preempt_disable_rt();
cpustat = &stat->cpustat[smp_processor_id()];
if (PageCgroupCache(pc))
__mem_cgroup_stat_add_safe(cpustat, MEM_CGROUP_STAT_CACHE, val);
@@ -182,6 +183,7 @@ static void mem_cgroup_charge_statistics(struct mem_cgroup *mem,
else
__mem_cgroup_stat_add_safe(cpustat,
MEM_CGROUP_STAT_PGPGOUT_COUNT, 1);
+ preempt_enable_rt();
}

static struct mem_cgroup_per_zone *
--
1.5.6.3


\
 
 \ /
  Last update: 2008-12-11 20:03    [W:0.257 / U:0.348 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site