mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Hugh Dickins <hughd@google.com>
To: Linus Torvalds <torvalds@linux-foundation.org>
Cc: Andrew Morton <akpm@linux-foundation.org>,
	Ming Lei <tom.leiming@gmail.com>,
	Paul Gortmaker <paul.gortmaker@windriver.com>,
	Shaohua Li <shli@fusionio.com>, Jens Axboe <axboe@kernel.dk>,
	Fan Du <fan.du@windriver.com>,
	linux-kernel@vger.kernel.org
Subject: [PATCH] percpu_counter: unbreak __percpu_counter_add()
Date: Thu, 16 Jan 2014 15:26:48 -0800 (PST)	[thread overview]
Message-ID: <alpine.LSU.2.11.1401161521340.1084@eggly.anvils> (raw)

Commit 74e72f894d56 ("lib/percpu_counter.c: fix __percpu_counter_add()")
looked very plausible, but its arithmetic was badly wrong: obvious once
you see the fix, but maddening to get there from the weird tmpfs ENOSPCs

Signed-off-by: Hugh Dickins <hughd@google.com>
---

 lib/percpu_counter.c |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

--- 3.13-rc8+/lib/percpu_counter.c	2014-01-15 09:53:27.768111792 -0800
+++ linux/lib/percpu_counter.c	2014-01-16 14:58:54.156555308 -0800
@@ -82,7 +82,7 @@ void __percpu_counter_add(struct percpu_
 		unsigned long flags;
 		raw_spin_lock_irqsave(&fbc->lock, flags);
 		fbc->count += count;
-		 __this_cpu_sub(*fbc->counters, count);
+		__this_cpu_sub(*fbc->counters, count - amount);
 		raw_spin_unlock_irqrestore(&fbc->lock, flags);
 	} else {
 		this_cpu_add(*fbc->counters, amount);

             reply	other threads:[~2014-01-16 23:27 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-01-16 23:26 Hugh Dickins [this message]
2014-01-17  1:58 ` Ming Lei

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.LSU.2.11.1401161521340.1084@eggly.anvils \
    --to=hughd@google.com \
    --cc=akpm@linux-foundation.org \
    --cc=axboe@kernel.dk \
    --cc=fan.du@windriver.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=paul.gortmaker@windriver.com \
    --cc=shli@fusionio.com \
    --cc=tom.leiming@gmail.com \
    --cc=torvalds@linux-foundation.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

all inboxes | Powered by JetHome®