Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753408AbdDDJlx (ORCPT ); Tue, 4 Apr 2017 05:41:53 -0400 Received: from mx2.suse.de ([195.135.220.15]:60611 "EHLO mx2.suse.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752833AbdDDJlw (ORCPT ); Tue, 4 Apr 2017 05:41:52 -0400 Date: Tue, 4 Apr 2017 11:41:48 +0200 From: Michal Hocko To: Andrey Ryabinin Cc: Thomas Hellstrom , akpm@linux-foundation.org, penguin-kernel@I-love.SAKURA.ne.jp, linux-kernel@vger.kernel.org, linux-mm@kvack.org, hpa@zytor.com, chris@chris-wilson.co.uk, hch@lst.de, mingo@elte.hu, jszhang@marvell.com, joelaf@google.com, joaodias@google.com, willy@infradead.org, tglx@linutronix.de, stable@vger.kernel.org Subject: Re: [PATCH 1/4] mm/vmalloc: allow to call vfree() in atomic context Message-ID: <20170404094148.GJ15132@dhcp22.suse.cz> References: <20170330102719.13119-1-aryabinin@virtuozzo.com> <2cfc601e-3093-143e-b93d-402f330a748a@vmware.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.5.23 (2014-03-12) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 999 Lines: 36 On Thu 30-03-17 17:48:39, Andrey Ryabinin wrote: > From: Andrey Ryabinin > Subject: mm/vmalloc: allow to call vfree() in atomic context fix > > Don't spawn worker if we already purging. > > Signed-off-by: Andrey Ryabinin I would rather put this into a separate patch. Ideally with some numners as this is an optimization... > --- > mm/vmalloc.c | 3 ++- > 1 file changed, 2 insertions(+), 1 deletion(-) > > diff --git a/mm/vmalloc.c b/mm/vmalloc.c > index ea1b4ab..88168b8 100644 > --- a/mm/vmalloc.c > +++ b/mm/vmalloc.c > @@ -737,7 +737,8 @@ static void free_vmap_area_noflush(struct vmap_area *va) > /* After this point, we may free va at any time */ > llist_add(&va->purge_list, &vmap_purge_list); > > - if (unlikely(nr_lazy > lazy_max_pages())) > + if (unlikely(nr_lazy > lazy_max_pages()) && > + !mutex_is_locked(&vmap_purge_lock)) > schedule_work(&purge_vmap_work); > } > > -- > 2.10.2 > -- Michal Hocko SUSE Labs