linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
From: "Zhang, Yanmin" <yanmin_zhang@linux.intel.com>
To: Christoph Lameter <cl@linux-foundation.org>
Cc: KAMEZAWA Hiroyuki <kamezawa.hiroyu@jp.fujitsu.com>,
	"hugh.dickins@tiscali.co.uk" <hugh.dickins@tiscali.co.uk>,
	linux-mm@kvack.org, linux-kernel@vger.kernel.org,
	akpm@linux-foundation.org, Tejun Heo <tj@kernel.org>,
	Andi Kleen <andi@firstfloor.org>
Subject: Re: [MM] Make mm counters per cpu instead of atomic
Date: Tue, 17 Nov 2009 14:48:41 +0800	[thread overview]
Message-ID: <1258440521.11321.32.camel@localhost> (raw)
In-Reply-To: <alpine.DEB.1.10.0911041409020.7409@V090114053VZO-1>

On Wed, 2009-11-04 at 14:14 -0500, Christoph Lameter wrote:
> From: Christoph Lameter <cl@linux-foundation.org>
> Subject: Make mm counters per cpu
> 
> Changing the mm counters to per cpu counters is possible after the introduction
> of the generic per cpu operations (currently in percpu and -next).
> 
> With that the contention on the counters in mm_struct can be avoided. The
> USE_SPLIT_PTLOCKS case distinction can go away. Larger SMP systems do not
> need to perform atomic updates to mm counters anymore. Various code paths
> can be simplified since per cpu counter updates are fast and batching
> of counter updates is no longer needed.
> 
> One price to pay for these improvements is the need to scan over all percpu
> counters when the actual count values are needed.
> 
> Signed-off-by: Christoph Lameter <cl@linux-foundation.org>
> 
> ---
>  fs/proc/task_mmu.c       |   14 +++++++++-
>  include/linux/mm_types.h |   16 ++++--------
>  include/linux/sched.h    |   61 ++++++++++++++++++++---------------------------
>  kernel/fork.c            |   25 ++++++++++++++-----
>  mm/filemap_xip.c         |    2 -
>  mm/fremap.c              |    2 -
>  mm/init-mm.c             |    3 ++
>  mm/memory.c              |   20 +++++++--------
>  mm/rmap.c                |   10 +++----
>  mm/swapfile.c            |    2 -
>  10 files changed, 84 insertions(+), 71 deletions(-)
> 
> Index: linux-2.6/include/linux/mm_types.h
> ===================================================================
> --- linux-2.6.orig/include/linux/mm_types.h	2009-11-04 13:08:33.000000000 -0600
> +++ linux-2.6/include/linux/mm_types.h	2009-11-04 13:13:42.000000000 -0600
> @@ -24,11 +24,10 @@ struct address_space;

> Index: linux-2.6/kernel/fork.c
> ===================================================================
> --- linux-2.6.orig/kernel/fork.c	2009-11-04 13:08:33.000000000 -0600
> +++ linux-2.6/kernel/fork.c	2009-11-04 13:14:19.000000000 -0600
> @@ -444,6 +444,8 @@ static void mm_init_aio(struct mm_struct
> 
>  static struct mm_struct * mm_init(struct mm_struct * mm, struct task_struct *p)
>  {
> +	int cpu;
> +
>  	atomic_set(&mm->mm_users, 1);
>  	atomic_set(&mm->mm_count, 1);
>  	init_rwsem(&mm->mmap_sem);
> @@ -452,8 +454,11 @@ static struct mm_struct * mm_init(struct
>  		(current->mm->flags & MMF_INIT_MASK) : default_dump_filter;
>  	mm->core_state = NULL;
>  	mm->nr_ptes = 0;
> -	set_mm_counter(mm, file_rss, 0);
> -	set_mm_counter(mm, anon_rss, 0);
> +	for_each_possible_cpu(cpu) {
> +		struct mm_counter *m;
> +
> +		memset(m, sizeof(struct mm_counter), 0);
Above memset is wrong.
1) m isn't initiated;
2) It seems the 2nd and the 3rd parameters should be interchanged.


--
To unsubscribe, send a message with 'unsubscribe linux-mm' in
the body to majordomo@kvack.org.  For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"dont@kvack.org"> email@kvack.org </a>

  parent reply	other threads:[~2009-11-17  6:46 UTC|newest]

Thread overview: 33+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-11-04 19:14 Christoph Lameter
2009-11-04 19:17 ` [MM] Remove rss batching from copy_page_range() Christoph Lameter
2009-11-04 21:02   ` Andi Kleen
2009-11-04 22:02     ` Christoph Lameter
2009-11-05  8:27       ` Andi Kleen
2009-11-04 21:01 ` [MM] Make mm counters per cpu instead of atomic Andi Kleen
2009-11-04 23:49 ` Dave Jones
2009-11-05 15:04   ` Christoph Lameter
2009-11-05 15:36     ` [MM] Make mm counters per cpu instead of atomic V2 Christoph Lameter
2009-11-06  1:11       ` KAMEZAWA Hiroyuki
2009-11-06  3:23         ` KAMEZAWA Hiroyuki
2009-11-06 17:32           ` Christoph Lameter
2009-11-06 19:03             ` KAMEZAWA Hiroyuki
2009-11-06 19:13               ` Christoph Lameter
2009-11-06 19:20                 ` KAMEZAWA Hiroyuki
2009-11-06 19:47                   ` Christoph Lameter
2009-11-10 22:44         ` Andrew Morton
2009-11-10 23:20           ` Christoph Lameter
2009-11-06  4:08       ` KAMEZAWA Hiroyuki
2009-11-06  4:15       ` KAMEZAWA Hiroyuki
2009-11-05  1:16 ` [MM] Make mm counters per cpu instead of atomic KAMEZAWA Hiroyuki
2009-11-05 15:10   ` Christoph Lameter
2009-11-05 23:42     ` KAMEZAWA Hiroyuki
2009-11-17  6:48 ` Zhang, Yanmin [this message]
2009-11-17  7:31   ` Zhang, Yanmin
2009-11-17  9:34     ` Zhang, Yanmin
2009-11-17 17:25       ` Christoph Lameter
2009-11-19  0:48         ` Zhang, Yanmin
2009-11-23  8:51         ` Zhang, Yanmin
2009-11-23 14:31           ` Christoph Lameter
2009-11-24  8:02             ` Zhang, Yanmin
2009-11-24 15:17               ` Christoph Lameter
2009-11-25  1:23                 ` Zhang, Yanmin

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1258440521.11321.32.camel@localhost \
    --to=yanmin_zhang@linux.intel.com \
    --cc=akpm@linux-foundation.org \
    --cc=andi@firstfloor.org \
    --cc=cl@linux-foundation.org \
    --cc=hugh.dickins@tiscali.co.uk \
    --cc=kamezawa.hiroyu@jp.fujitsu.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mm@kvack.org \
    --cc=tj@kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox