Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S932252AbcKGPJv (ORCPT ); Mon, 7 Nov 2016 10:09:51 -0500 Received: from verein.lst.de ([213.95.11.211]:57044 "EHLO newverein.lst.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752814AbcKGPJt (ORCPT ); Mon, 7 Nov 2016 10:09:49 -0500 Date: Mon, 7 Nov 2016 16:09:47 +0100 From: Christoph Hellwig To: Andrey Ryabinin Cc: Joel Fernandes , Christoph Hellwig , Andrew Morton , Jisheng Zhang , Chris Wilson , John Dias , "open list:MEMORY MANAGEMENT" , linux-rt-users@vger.kernel.org, LKML , Andy Lutomirski Subject: Re: [PATCH 4/7] mm: defer vmalloc from atomic context Message-ID: <20161107150947.GA11279@lst.de> References: <1477149440-12478-1-git-send-email-hch@lst.de> <1477149440-12478-5-git-send-email-hch@lst.de> <25c117ae-6d06-9846-6a88-ae6221ad6bfe@virtuozzo.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.5.17 (2007-11-01) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 949 Lines: 25 On Mon, Nov 07, 2016 at 06:01:45PM +0300, Andrey Ryabinin wrote: > > So because in_atomic doesn't work for !CONFIG_PREEMPT kernels, can we > > always defer the work in these cases? > > > > So for non-preemptible kernels, we always defer: > > > > if (!IS_ENABLED(CONFIG_PREEMPT) || in_atomic()) { > > // defer > > } > > > > Is this fine? Or any other ideas? > > > > What's wrong with my idea? > We can add vfree_in_atomic() and use it to free vmapped stacks > and for any other places where vfree() used 'in_atomict() && !in_interrupt()' context. I somehow missed the mail, sorry. That beeing said always defer is going to suck badly in terms of performance, so I'm not sure it's an all that good idea. vfree_in_atomic sounds good, but I wonder if we'll need to annotate more callers than just the stacks. I'm fairly bust this week, do you want to give that a spin? Otherwise I'll give it a try towards the end of this week or next week.