linux-fsdevel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Christoph Lameter <cl@linux.com>
To: Andrew Morton <akpm@linux-foundation.org>
Cc: Sergey Senozhatsky <sergey.senozhatsky@gmail.com>,
	Alexander Viro <viro@zeniv.linux.org.uk>,
	Mel Gorman <mgorman@suse.de>, Michal Hocko <mhocko@suse.cz>,
	Rik van Riel <riel@redhat.com>,
	Johannes Weiner <hannes@cmpxchg.org>,
	linux-fsdevel@vger.kernel.org, linux-mm@kvack.org,
	linux-kernel@vger.kernel.org
Subject: Re: kswapd using __this_cpu_add() in preemptible code
Date: Thu, 20 Mar 2014 09:04:50 -0500 (CDT)	[thread overview]
Message-ID: <alpine.DEB.2.10.1403200859050.4107@nuc> (raw)
In-Reply-To: <20140318142216.317bf986d10a564881791100@linux-foundation.org>

On Tue, 18 Mar 2014, Andrew Morton wrote:

> Christoph caught one.  How does this look?

The fundamental decision to be made here is if we want the counter
overhead coming on platforms that do not have lockless percpu atomics
and therefore would require an irq on/off sequence for safe counter
increments.

So far we have said that we do allow the counters to be racy for
performance sake. Your patch would remove the races.

If we want to keep the races and the performance than we need to change
__count_vm_events to use raw_cpu_add instead of __this_cpu_add.


Subject: vmstat: Use raw_cpu_ops to avoid false positives on preemption checks

vm counters are allowed to be racy. Use raw_cpu_ops to avoid preemption checks.

Signed-off-by: Christoph Lameter <cl@linux.com>

Index: linux/include/linux/vmstat.h
===================================================================
--- linux.orig/include/linux/vmstat.h	2014-02-10 08:54:02.318697828 -0600
+++ linux/include/linux/vmstat.h	2014-03-20 09:02:05.132852038 -0500
@@ -29,7 +29,7 @@ DECLARE_PER_CPU(struct vm_event_state, v

 static inline void __count_vm_event(enum vm_event_item item)
 {
-	__this_cpu_inc(vm_event_states.event[item]);
+	raw_cpu_inc(vm_event_states.event[item]);
 }

 static inline void count_vm_event(enum vm_event_item item)
@@ -39,7 +39,7 @@ static inline void count_vm_event(enum v

 static inline void __count_vm_events(enum vm_event_item item, long delta)
 {
-	__this_cpu_add(vm_event_states.event[item], delta);
+	raw_cpu_add(vm_event_states.event[item], delta);
 }

 static inline void count_vm_events(enum vm_event_item item, long delta)

--
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:[~2014-03-20 14:04 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-03-18 18:53 kswapd using __this_cpu_add() in preemptible code Sergey Senozhatsky
2014-03-18 21:22 ` Andrew Morton
2014-03-19  6:20   ` Sergey Senozhatsky
2014-03-20  1:01   ` Dave Chinner
2014-03-20 14:04   ` Christoph Lameter [this message]

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.10.1403200859050.4107@nuc \
    --to=cl@linux.com \
    --cc=akpm@linux-foundation.org \
    --cc=hannes@cmpxchg.org \
    --cc=linux-fsdevel@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mm@kvack.org \
    --cc=mgorman@suse.de \
    --cc=mhocko@suse.cz \
    --cc=riel@redhat.com \
    --cc=sergey.senozhatsky@gmail.com \
    --cc=viro@zeniv.linux.org.uk \
    /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;
as well as URLs for NNTP newsgroup(s).