Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751828AbdFITPq (ORCPT ); Fri, 9 Jun 2017 15:15:46 -0400 Received: from mail-lf0-f49.google.com ([209.85.215.49]:33930 "EHLO mail-lf0-f49.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751561AbdFITPo (ORCPT ); Fri, 9 Jun 2017 15:15:44 -0400 MIME-Version: 1.0 In-Reply-To: <20170522194814.4681ef0b@alans-desktop> References: <20170521004546.29795-1-weiyj.lk@gmail.com> <20170521074836.GA24459@dhcp22.suse.cz> <20170522115152.GH8509@dhcp22.suse.cz> <20170522194814.4681ef0b@alans-desktop> From: Jin Qian Date: Fri, 9 Jun 2017 12:15:42 -0700 Message-ID: Subject: Re: [PATCH] goldfish_pipe: use GFP_ATOMIC under spin lock To: Alan Cox Cc: Michal Hocko , Wei Yongjun , Greg Kroah-Hartman , lstoakes@gmail.com, jack@suse.cz, christian.koenig@amd.com, Wei Yongjun , linux-kernel@vger.kernel.org Content-Type: text/plain; charset="UTF-8" Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 1044 Lines: 31 Reviewed-by: Jin Qian Can we merge this to stable? Thanks! jin On Mon, May 22, 2017 at 11:48 AM, Alan Cox wrote: > 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