[patch 1/8] mm: memcg: remove unnecessary preemption disabling

2014-03-11 Thread Johannes Weiner
lock_page_cgroup() disables preemption, remove explicit preemption
disabling for code paths holding this lock.

Signed-off-by: Johannes Weiner 
Acked-by: Michal Hocko 
---
 mm/memcontrol.c | 15 ---
 1 file changed, 4 insertions(+), 11 deletions(-)

diff --git a/mm/memcontrol.c b/mm/memcontrol.c
index 5b6b0039f725..393864c162ac 100644
--- a/mm/memcontrol.c
+++ b/mm/memcontrol.c
@@ -921,8 +921,6 @@ static void mem_cgroup_charge_statistics(struct mem_cgroup 
*memcg,
 struct page *page,
 bool anon, int nr_pages)
 {
-   preempt_disable();
-
/*
 * Here, RSS means 'mapped anon' and anon's SwapCache. Shmem/tmpfs is
 * counted as CACHE even if it's on ANON LRU.
@@ -947,8 +945,6 @@ static void mem_cgroup_charge_statistics(struct mem_cgroup 
*memcg,
}
 
__this_cpu_add(memcg->stat->nr_page_events, nr_pages);
-
-   preempt_enable();
 }
 
 unsigned long
@@ -3780,17 +3776,14 @@ void mem_cgroup_split_huge_fixup(struct page *head)
 }
 #endif /* CONFIG_TRANSPARENT_HUGEPAGE */
 
-static inline
-void mem_cgroup_move_account_page_stat(struct mem_cgroup *from,
-   struct mem_cgroup *to,
-   unsigned int nr_pages,
-   enum mem_cgroup_stat_index idx)
+static void mem_cgroup_move_account_page_stat(struct mem_cgroup *from,
+ struct mem_cgroup *to,
+ unsigned int nr_pages,
+ enum mem_cgroup_stat_index idx)
 {
/* Update stat data for mem_cgroup */
-   preempt_disable();
__this_cpu_sub(from->stat->count[idx], nr_pages);
__this_cpu_add(to->stat->count[idx], nr_pages);
-   preempt_enable();
 }
 
 /**
-- 
1.9.0

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [patch 1/8] mm: memcg: remove unnecessary preemption disabling

2014-02-10 Thread Michal Hocko
On Fri 07-02-14 12:04:18, Johannes Weiner wrote:
> lock_page_cgroup() disables preemption, remove explicit preemption
> disabling for code paths holding this lock.
> 
> Signed-off-by: Johannes Weiner 

It would be better to document the dependency on lock_page_cgroup. But
the patch looks correct.

Acked-by: Michal Hocko 

> ---
>  mm/memcontrol.c | 15 ---
>  1 file changed, 4 insertions(+), 11 deletions(-)
> 
> diff --git a/mm/memcontrol.c b/mm/memcontrol.c
> index 53385cd4e6f0..befb3dd9d46c 100644
> --- a/mm/memcontrol.c
> +++ b/mm/memcontrol.c
> @@ -921,8 +921,6 @@ static void mem_cgroup_charge_statistics(struct 
> mem_cgroup *memcg,
>struct page *page,
>bool anon, int nr_pages)
>  {
> - preempt_disable();
> -
>   /*
>* Here, RSS means 'mapped anon' and anon's SwapCache. Shmem/tmpfs is
>* counted as CACHE even if it's on ANON LRU.
> @@ -947,8 +945,6 @@ static void mem_cgroup_charge_statistics(struct 
> mem_cgroup *memcg,
>   }
>  
>   __this_cpu_add(memcg->stat->nr_page_events, nr_pages);
> -
> - preempt_enable();
>  }
>  
>  unsigned long
> @@ -3780,17 +3776,14 @@ void mem_cgroup_split_huge_fixup(struct page *head)
>  }
>  #endif /* CONFIG_TRANSPARENT_HUGEPAGE */
>  
> -static inline
> -void mem_cgroup_move_account_page_stat(struct mem_cgroup *from,
> - struct mem_cgroup *to,
> - unsigned int nr_pages,
> - enum mem_cgroup_stat_index idx)
> +static void mem_cgroup_move_account_page_stat(struct mem_cgroup *from,
> +   struct mem_cgroup *to,
> +   unsigned int nr_pages,
> +   enum mem_cgroup_stat_index idx)
>  {
>   /* Update stat data for mem_cgroup */
> - preempt_disable();
>   __this_cpu_sub(from->stat->count[idx], nr_pages);
>   __this_cpu_add(to->stat->count[idx], nr_pages);
> - preempt_enable();
>  }
>  
>  /**
> -- 
> 1.8.5.3
> 

-- 
Michal Hocko
SUSE Labs
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[patch 1/8] mm: memcg: remove unnecessary preemption disabling

2014-02-07 Thread Johannes Weiner
lock_page_cgroup() disables preemption, remove explicit preemption
disabling for code paths holding this lock.

Signed-off-by: Johannes Weiner 
---
 mm/memcontrol.c | 15 ---
 1 file changed, 4 insertions(+), 11 deletions(-)

diff --git a/mm/memcontrol.c b/mm/memcontrol.c
index 53385cd4e6f0..befb3dd9d46c 100644
--- a/mm/memcontrol.c
+++ b/mm/memcontrol.c
@@ -921,8 +921,6 @@ static void mem_cgroup_charge_statistics(struct mem_cgroup 
*memcg,
 struct page *page,
 bool anon, int nr_pages)
 {
-   preempt_disable();
-
/*
 * Here, RSS means 'mapped anon' and anon's SwapCache. Shmem/tmpfs is
 * counted as CACHE even if it's on ANON LRU.
@@ -947,8 +945,6 @@ static void mem_cgroup_charge_statistics(struct mem_cgroup 
*memcg,
}
 
__this_cpu_add(memcg->stat->nr_page_events, nr_pages);
-
-   preempt_enable();
 }
 
 unsigned long
@@ -3780,17 +3776,14 @@ void mem_cgroup_split_huge_fixup(struct page *head)
 }
 #endif /* CONFIG_TRANSPARENT_HUGEPAGE */
 
-static inline
-void mem_cgroup_move_account_page_stat(struct mem_cgroup *from,
-   struct mem_cgroup *to,
-   unsigned int nr_pages,
-   enum mem_cgroup_stat_index idx)
+static void mem_cgroup_move_account_page_stat(struct mem_cgroup *from,
+ struct mem_cgroup *to,
+ unsigned int nr_pages,
+ enum mem_cgroup_stat_index idx)
 {
/* Update stat data for mem_cgroup */
-   preempt_disable();
__this_cpu_sub(from->stat->count[idx], nr_pages);
__this_cpu_add(to->stat->count[idx], nr_pages);
-   preempt_enable();
 }
 
 /**
-- 
1.8.5.3

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/