Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S932306AbcDFL4w (ORCPT ); Wed, 6 Apr 2016 07:56:52 -0400 Received: from mail-wm0-f68.google.com ([74.125.82.68]:35857 "EHLO mail-wm0-f68.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753295AbcDFL4u (ORCPT ); Wed, 6 Apr 2016 07:56:50 -0400 Date: Wed, 6 Apr 2016 13:56:46 +0200 From: Michal Hocko To: Vladimir Davydov Cc: Andrew Morton , Peter Zijlstra , Christoph Lameter , Joonsoo Kim , Pekka Enberg , David Rientjes , Johannes Weiner , linux-mm@kvack.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH] mm: slub: replace kick_all_cpus_sync with synchronize_sched in kmem_cache_shrink Message-ID: <20160406115646.GG24272@dhcp22.suse.cz> References: <1459513817-11853-1-git-send-email-vdavydov@virtuozzo.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <1459513817-11853-1-git-send-email-vdavydov@virtuozzo.com> User-Agent: Mutt/1.5.24 (2015-08-30) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 2059 Lines: 54 On Fri 01-04-16 15:30:17, Vladimir Davydov wrote: > When we call __kmem_cache_shrink on memory cgroup removal, we need to > synchronize kmem_cache->cpu_partial update with put_cpu_partial that > might be running on other cpus. Currently, we achieve that by using > kick_all_cpus_sync, which works as a system wide memory barrier. Though > fast it is, this method has a flow - it issues a lot of IPIs, which > might hurt high performance or real-time workloads. > > To fix this, let's replace kick_all_cpus_sync with synchronize_sched. > Although the latter one may take much longer to finish, it shouldn't be > a problem in this particular case, because memory cgroups are destroyed > asynchronously from a workqueue so that no user visible effects should > be introduced. OTOH, it will save us from excessive IPIs when someone > removes a cgroup. > > Anyway, even if using synchronize_sched turns out to take too long, we > can always introduce a kind of __kmem_cache_shrink batching so that this > method would only be called once per one cgroup destruction (not per > each per memcg kmem cache as it is now). > > Reported-and-suggested-by: Peter Zijlstra > Signed-off-by: Vladimir Davydov Acked-by: Michal Hocko > --- > mm/slub.c | 2 +- > 1 file changed, 1 insertion(+), 1 deletion(-) > > diff --git a/mm/slub.c b/mm/slub.c > index 279e773d80d3..03067f43dcf4 100644 > --- a/mm/slub.c > +++ b/mm/slub.c > @@ -3697,7 +3697,7 @@ int __kmem_cache_shrink(struct kmem_cache *s, bool deactivate) > * s->cpu_partial is checked locklessly (see put_cpu_partial), > * so we have to make sure the change is visible. > */ > - kick_all_cpus_sync(); > + synchronize_sched(); > } > > flush_all(s); > -- > 2.1.4 > > -- > 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/ . > Don't email: email@kvack.org -- Michal Hocko SUSE Labs