From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753276AbdDDJhA (ORCPT ); Tue, 4 Apr 2017 05:37:00 -0400 Received: from mx2.suse.de ([195.135.220.15]:59655 "EHLO mx2.suse.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753214AbdDDJg6 (ORCPT ); Tue, 4 Apr 2017 05:36:58 -0400 Date: Tue, 4 Apr 2017 11:36:53 +0200 From: Michal Hocko To: Andrew Morton Cc: Andrey Ryabinin , 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, thellstrom@vmware.com, stable@vger.kernel.org Subject: Re: [PATCH 1/4] mm/vmalloc: allow to call vfree() in atomic context Message-ID: <20170404093653.GG15132@dhcp22.suse.cz> References: <20170330102719.13119-1-aryabinin@virtuozzo.com> <20170330152229.f2108e718114ed77acae7405@linux-foundation.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20170330152229.f2108e718114ed77acae7405@linux-foundation.org> 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 On Thu 30-03-17 15:22:29, Andrew Morton wrote: > On Thu, 30 Mar 2017 13:27:16 +0300 Andrey Ryabinin wrote: [...] > > This can be fixed in vmgfx, but it would be better to make vfree() > > non-sleeping again because we may have other bugs like this one. > > I tend to disagree: adding yet another schedule_work() introduces > additional overhead and adds some risk of ENOMEM errors which wouldn't > occur with a synchronous free. I do not think ENOMEM would be a problem. We are talking about lazy handling already. Besides that the allocation path also does this lazy free AFAICS. > > __purge_vmap_area_lazy() is the only function in the vfree() path that > > wants to be able to sleep. So it make sense to schedule > > __purge_vmap_area_lazy() via schedule_work() so it runs only in sleepable > > context. > > vfree() already does > > if (unlikely(in_interrupt())) > __vfree_deferred(addr); > > so it seems silly to introduce another defer-to-kernel-thread thing > when we already have one. But this only cares about the IRQ context and this patch aims at atomic context in general. I agree it would have been better to reduce this deferred behavior to only _atomic_ context but we not have a reliable way to detect that on non-preemptive kernels AFAIR. -- Michal Hocko SUSE Labs