From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-6.8 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI, NICE_REPLY_A,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED autolearn=no autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 97774C43461 for ; Wed, 16 Sep 2020 01:17:53 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 56D5520BED for ; Wed, 16 Sep 2020 01:17:53 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1600219073; bh=AhUHdnUo9rJC4ndiU3DPdecCdebXpTSRQ5+5l3tt/Rc=; h=Date:From:To:Cc:Subject:In-Reply-To:References:List-ID:From; b=nmjTD/cDNJu8ldRsodw83fVxEPT5ZNN87Y9gs/Z4SRmQQAY+vQRsR6y+n2uA5Ro+s GoQMMWOUNps5IACM3yHgX98KWTHQ0d1nTR4jcTxIEcCDbd93jwi3sQ8Rl36quJqXHq EFoqI5A4Nzzeq7gcRxfvcYLsxeC3orzHi/mYnzS4= Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726212AbgIPBRv (ORCPT ); Tue, 15 Sep 2020 21:17:51 -0400 Received: from mail.kernel.org ([198.145.29.99]:56656 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726061AbgIPBRu (ORCPT ); Tue, 15 Sep 2020 21:17:50 -0400 Received: from X1 (unknown [67.22.170.76]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 36E8A207DE; Wed, 16 Sep 2020 01:17:50 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1600219070; bh=AhUHdnUo9rJC4ndiU3DPdecCdebXpTSRQ5+5l3tt/Rc=; h=Date:From:To:Cc:Subject:In-Reply-To:References:From; b=vEGWVXqW0XORjvPLXUCTjGJjOkgr3iekyk2VnZoNYdpLT0WSxr3JRDU08fmPZPEH4 m8tnBGaSqBBcFN2q9/IDrD1x/ioYcHzfgW4AglvJmV/ua9/OxpTY19TdcArFzozl5U 1WymYuFrqxY+zfNdSrFzPllVgfWmmRn7zZrkylTw= Date: Tue, 15 Sep 2020 18:17:49 -0700 From: Andrew Morton To: Cc: , Subject: Re: [PATCH] mm/page_alloc.c: avoid inheritting current's flags when invoked in interrupt Message-Id: <20200915181749.2bb7420e2c7e62267b21a0fc@linux-foundation.org> In-Reply-To: <20200915075635.1112-1-yanfei.xu@windriver.com> References: <20200915075635.1112-1-yanfei.xu@windriver.com> X-Mailer: Sylpheed 3.5.1 (GTK+ 2.24.32; x86_64-pc-linux-gnu) Mime-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Tue, 15 Sep 2020 15:56:35 +0800 wrote: > From: Yanfei Xu > > alloc_mask shouldn't inherit the current task's flags when > __alloc_pages_nodemask is invoked in interrupt. > > ... > > --- a/mm/page_alloc.c > +++ b/mm/page_alloc.c > @@ -4889,7 +4889,8 @@ __alloc_pages_nodemask(gfp_t gfp_mask, unsigned int order, int preferred_nid, > * from a particular context which has been marked by > * memalloc_no{fs,io}_{save,restore}. > */ > - alloc_mask = current_gfp_context(gfp_mask); > + if (!in_interrupt()) > + alloc_mask = current_gfp_context(gfp_mask); > ac.spread_dirty_pages = false; > > /* hm, yes, and perhaps other callsites in page_alloc.c. I assume this doesn't actually make any runtime difference? Because gfp_mask in interrupt contexts isn't going to have __GFP_IO or __GFP_FS anyway.