From: Christoph Lameter <cl@linux-foundation.org>
To: KAMEZAWA Hiroyuki <kamezawa.hiroyu@jp.fujitsu.com>
Cc: "linux-mm@kvack.org" <linux-mm@kvack.org>,
"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>,
"akpm@linux-foundation.org" <akpm@linux-foundation.org>,
minchan.kim@gmail.com, Lee.Schermerhorn@hp.com
Subject: Re: [mmotm][PATCH 2/5] mm : avoid false sharing on mm_counter
Date: Tue, 15 Dec 2009 09:25:01 -0600 (CST) [thread overview]
Message-ID: <alpine.DEB.2.00.0912150920160.16754@router.home> (raw)
In-Reply-To: <20091215181337.1c4f638d.kamezawa.hiroyu@jp.fujitsu.com>
On Tue, 15 Dec 2009, KAMEZAWA Hiroyuki wrote:
> #if USE_SPLIT_PTLOCKS
> +#define SPLIT_RSS_COUNTING
> struct mm_rss_stat {
> atomic_long_t count[NR_MM_COUNTERS];
> };
> +/* per-thread cached information, */
> +struct task_rss_stat {
> + int events; /* for synchronization threshold */
Why count events? Just always increment the task counters and fold them
at appropriate points into mm_struct. Or get rid of the mm_struct counters
and only sum them up on the fly if needed?
Add a pointer to thread rss_stat structure to mm_struct and remove the
counters? If the task has only one thread then the pointer points to the
accurate data (most frequent case). Otherwise it can be NULL and then we
calculate it on the fly?
> +static void add_mm_counter_fast(struct mm_struct *mm, int member, int val)
> +{
> + struct task_struct *task = current;
> +
> + if (likely(task->mm == mm))
> + task->rss_stat.count[member] += val;
> + else
> + add_mm_counter(mm, member, val);
> +}
> +#define inc_mm_counter_fast(mm, member) add_mm_counter_fast(mm, member,1)
> +#define dec_mm_counter_fast(mm, member) add_mm_counter_fast(mm, member,-1)
> +
Code will be much simpler if you always increment the task counts.
--
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>
next prev parent reply other threads:[~2009-12-15 15:25 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2009-12-15 9:09 [mmotm][PATCH 0/5] mm rss counting updates KAMEZAWA Hiroyuki
2009-12-15 9:11 ` [mmotm][PATCH 1/5] clean up mm_counter KAMEZAWA Hiroyuki
2009-12-15 23:25 ` Minchan Kim
2009-12-15 23:53 ` KAMEZAWA Hiroyuki
2009-12-15 9:13 ` [mmotm][PATCH 2/5] mm : avoid false sharing on mm_counter KAMEZAWA Hiroyuki
2009-12-15 15:25 ` Christoph Lameter [this message]
2009-12-15 16:54 ` KAMEZAWA Hiroyuki
2009-12-15 23:48 ` Minchan Kim
2009-12-15 9:14 ` [mmotm][PATCH 3/5] mm: count swap usage KAMEZAWA Hiroyuki
2009-12-15 9:15 ` [mmotm][PATCH 4/5] mm : add lowmem detection logic KAMEZAWA Hiroyuki
2009-12-15 9:16 ` [mmotm][PATCH 5/5] mm : count lowmem rss KAMEZAWA Hiroyuki
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=alpine.DEB.2.00.0912150920160.16754@router.home \
--to=cl@linux-foundation.org \
--cc=Lee.Schermerhorn@hp.com \
--cc=akpm@linux-foundation.org \
--cc=kamezawa.hiroyu@jp.fujitsu.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-mm@kvack.org \
--cc=minchan.kim@gmail.com \
/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