Date: Wed, 24 Feb 2021 11:10:43 -0800 From: Linus Torvalds <torvalds@...ux-foundation.org> To: Alexey Gladkov <gladkov.alexey@...il.com> Cc: "Eric W. Biederman" <ebiederm@...ssion.com>, kernel test robot <oliver.sang@...el.com>, 0day robot <lkp@...el.com>, LKML <linux-kernel@...r.kernel.org>, lkp@...ts.01.org, "Huang, Ying" <ying.huang@...el.com>, Feng Tang <feng.tang@...el.com>, zhengjun.xing@...el.com, io-uring <io-uring@...r.kernel.org>, Kernel Hardening <kernel-hardening@...ts.openwall.com>, Linux Containers <containers@...ts.linux-foundation.org>, Linux-MM <linux-mm@...ck.org>, Andrew Morton <akpm@...ux-foundation.org>, Christian Brauner <christian.brauner@...ntu.com>, Jann Horn <jannh@...gle.com>, Jens Axboe <axboe@...nel.dk>, Kees Cook <keescook@...omium.org>, Oleg Nesterov <oleg@...hat.com> Subject: Re: d28296d248: stress-ng.sigsegv.ops_per_sec -82.7% regression On Wed, Feb 24, 2021 at 10:38 AM Alexey Gladkov <gladkov.alexey@...il.com> 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 refcount). 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. Linus
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.