From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1760952AbdEVSsc (ORCPT ); Mon, 22 May 2017 14:48:32 -0400 Received: from www.llwyncelyn.cymru ([82.70.14.225]:50036 "EHLO fuzix.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1759742AbdEVSs3 (ORCPT ); Mon, 22 May 2017 14:48:29 -0400 Date: Mon, 22 May 2017 19:48:14 +0100 From: Alan Cox To: Michal Hocko Cc: Wei Yongjun , jinqian@android.com, gregkh@linuxfoundation.org, lstoakes@gmail.com, jack@suse.cz, christian.koenig@amd.com, Wei Yongjun , linux-kernel@vger.kernel.org Subject: Re: [PATCH] goldfish_pipe: use GFP_ATOMIC under spin lock Message-ID: <20170522194814.4681ef0b@alans-desktop> In-Reply-To: <20170522115152.GH8509@dhcp22.suse.cz> References: <20170521004546.29795-1-weiyj.lk@gmail.com> <20170521074836.GA24459@dhcp22.suse.cz> <20170522115152.GH8509@dhcp22.suse.cz> Organization: Intel Corporation X-Mailer: Claws Mail 3.14.1 (GTK+ 2.24.31; x86_64-redhat-linux-gnu) MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Mon, 22 May 2017 13:51:52 +0200 Michal Hocko wrote: > On Sun 21-05-17 09:48:36, Michal Hocko wrote: > > On Sun 21-05-17 00:45:46, Wei Yongjun wrote: > > > From: Wei Yongjun > > > > > > The function get_free_pipe_id_locked() is called from > > > goldfish_pipe_open() with a lock is held, so we should > > > use GFP_ATOMIC instead of GFP_KERNEL. > > > > Why is GFP_NOWAIT insufficient? Does this path needs an access to memory > > reserves? > > And now when looking at the code more deeply, wouldn't it be much better > to simply do the allocation outside of the spin lock and do assignments > with the lock held? That's far from trivial and certainly for backporting and an immediate fix this seems better. The allocations are not that large and any fail would be in open() not anywhere weird. Alan