linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
From: Christoph Lameter <cl@linux.com>
To: Eric Dumazet <eric.dumazet@gmail.com>
Cc: akpm@linux-foundation.org, linux-mm@kvack.org
Subject: Re: percpu: Implement this_cpu_add,sub,dec,inc_return
Date: Fri, 19 Nov 2010 09:59:08 -0600 (CST)	[thread overview]
Message-ID: <alpine.DEB.2.00.1011190958230.2360@router.home> (raw)
In-Reply-To: <1290181870.3034.136.camel@edumazet-laptop>

On Fri, 19 Nov 2010, Eric Dumazet wrote:

> > This isnt a use case for this_cpu_dec right? Seems that your message was
> > cut off?
> I wanted to show you the file were it was possible to use this_cpu_{dec|
> inc}_return()
>
> My patch on kmap_atomic_idx() doesnt need your new functions ;)

Oh ok you mean this:

---
 include/linux/highmem.h |    8 +++++---
 1 file changed, 5 insertions(+), 3 deletions(-)

Index: linux-2.6/include/linux/highmem.h
===================================================================
--- linux-2.6.orig/include/linux/highmem.h	2010-11-19 09:55:24.000000000 -0600
+++ linux-2.6/include/linux/highmem.h	2010-11-19 09:57:54.000000000 -0600
@@ -81,7 +81,9 @@ DECLARE_PER_CPU(int, __kmap_atomic_idx);

 static inline int kmap_atomic_idx_push(void)
 {
-	int idx = __get_cpu_var(__kmap_atomic_idx)++;
+	int idx = __this_cpu_read(__kmap_atomic_idx);
+
+	__this_cpu_inc(__kmap_atomic_idx);
 #ifdef CONFIG_DEBUG_HIGHMEM
 	WARN_ON_ONCE(in_irq() && !irqs_disabled());
 	BUG_ON(idx > KM_TYPE_NR);
@@ -91,12 +93,12 @@ static inline int kmap_atomic_idx_push(v

 static inline int kmap_atomic_idx(void)
 {
-	return __get_cpu_var(__kmap_atomic_idx) - 1;
+	return __this_cpu_read(__kmap_atomic_idx) - 1;
 }

 static inline int kmap_atomic_idx_pop(void)
 {
-	int idx = --__get_cpu_var(__kmap_atomic_idx);
+	int idx = __this_cpu_dec_return(__kmap_atomic_idx);
 #ifdef CONFIG_DEBUG_HIGHMEM
 	BUG_ON(idx < 0);
 #endif

--
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/ .
Fight unfair telecom policy in Canada: sign http://dissolvethecrtc.ca/
Don't email: <a href=mailto:"dont@kvack.org"> email@kvack.org </a>

  reply	other threads:[~2010-11-19 15:59 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-11-09 17:27 vmstat: Optimize zone counter modifications through the use of this cpu operations Christoph Lameter
2010-11-10 15:40 ` percpu: Implement this_cpu_add,sub,dec,inc_return Christoph Lameter
2010-11-17 18:28   ` Eric Dumazet
2010-11-19 15:42     ` Christoph Lameter
2010-11-19 15:51       ` Eric Dumazet
2010-11-19 15:59         ` Christoph Lameter [this message]
2010-11-19 16:12           ` Eric Dumazet
2010-11-19 17:09             ` Christoph Lameter
2010-11-19 17:59               ` Christoph Lameter
2010-11-20  9:50                 ` Eric Dumazet

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.1011190958230.2360@router.home \
    --to=cl@linux.com \
    --cc=akpm@linux-foundation.org \
    --cc=eric.dumazet@gmail.com \
    --cc=linux-mm@kvack.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