Follow @Openwall on Twitter for new release announcements and other news
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Date: Wed, 24 Feb 2021 11:10:43 -0800
From: Linus Torvalds <>
To: Alexey Gladkov <>
Cc: "Eric W. Biederman" <>, kernel test robot <>, 
	0day robot <>, LKML <>,, 
	"Huang, Ying" <>, Feng Tang <>,, 
	io-uring <>, 
	Kernel Hardening <>, 
	Linux Containers <>, Linux-MM <>, 
	Andrew Morton <>, 
	Christian Brauner <>, Jann Horn <>, 
	Jens Axboe <>, Kees Cook <>, Oleg Nesterov <>
Subject: Re: d28296d248: stress-ng.sigsegv.ops_per_sec -82.7% regression

On Wed, Feb 24, 2021 at 10:38 AM Alexey Gladkov
<> wrote:
> One of the reasons for this is that I rolled back the patch that changed
> the ucounts.count type to atomic_t. Now get_ucounts() is forced to use a
> spin_lock to increase the reference count.

Yeah, that definitely should be an atomic type, since the extended use
of ucounts clearly puts way too much pressure on that ucount lock.

I remember complaining about one version of that patch, but my
complaint wasabout it changing semantics of the saturation logic (and
I think it was also wrong because it still kept the spinlock for
get_ucounts(), so it didn't even take advantage of the atomic

Side note: I don't think a refcount_t" is necessarily the right thing
to do, since the ucount reference counter does its own saturation
logic, and the refcount_t version is imho not great.

So it probably just needs to use an atomic_t, and do the saturation
thing manually.

Side note: look at try_get_page(). That one actually does refcounting
with overflow protection better than refcount_t, in my opinion. But I
am obviously biased, since I wrote it ;)

See commits

    88b1a17dfc3e mm: add 'try_get_page()' helper function
    f958d7b528b1 mm: make page ref count overflow check tighter and
more explicit

with that "page->_recount" being just a regular atomic_t.


Powered by blists - more mailing lists

Confused about mailing lists and their use? Read about mailing lists on Wikipedia and check out these guidelines on proper formatting of your messages.