lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  PHC 
Open Source and information security mailing list archives
Hash Suite for Android: free password hash cracker in your pocket
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Date:	Sat, 16 Oct 2010 11:31:15 +0200
From:	Eric Dumazet <>
To:	Andrew Morton <>
Cc:	Nick Piggin <>,
	Dave Chinner <>,,
Subject: Re: [PATCH 16/17] fs: Convert nr_inodes to a per-cpu counter

Le samedi 16 octobre 2010 à 02:07 -0700, Andrew Morton a écrit :
> On Sat, 16 Oct 2010 10:29:08 +0200 Eric Dumazet <> wrote:
> > Some people believe percpu_counter object is the right answer to such
> > distributed counters, because the loop is done on 'online' cpus instead
> > of 'possible' cpus. "It must be better if number of possible cpus is
> > 4096 and only one or two cpus are online"...
> > 
> > But if we do this loop only on rare events, like
> > "cat /proc/sys/fs/inode-nr", then the percpu_counter() is more
> > expensive, because percpu_add() _is_ more expensive :
> > 
> > - Its a function call and lot of instructions/cycles per call, while
> > this_cpu_inc(nr_inodes) is a single instruction, using no register on
> > x86.
> You want an inlined percpu_counter_inc() then write one!  Bonus points
> for writing this_cpu_add_return() and doing it without a
> preempt_disable().  It collapses to just a few instructions.

A few instructions, but no guarantee of false sharing eviction.

Each time one cpu dirties the percpu_counter object, it slow down other
cpus because they need to fetch the cache line again.

Btw, I believe my previous patch against include/linux/percpu_counter.h
was lost. Are you sure I am the right guy to work on percpu_counter
infra ? If yes I can implement your inlined idea.


To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to
More majordomo info at
Please read the FAQ at

Powered by blists - more mailing lists