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=-15.8 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER, INCLUDES_PATCH,MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS autolearn=ham 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 3CF43C433DB for ; Tue, 26 Jan 2021 07:38:18 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id BEBF022273 for ; Tue, 26 Jan 2021 07:38:17 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org BEBF022273 Authentication-Results: mail.kernel.org; dmarc=fail (p=quarantine dis=none) header.from=suse.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=owner-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix) id 3F41D8D00A7; Tue, 26 Jan 2021 02:38:17 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id 3A42E8D0076; Tue, 26 Jan 2021 02:38:17 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 2B9998D00A7; Tue, 26 Jan 2021 02:38:17 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0136.hostedemail.com [216.40.44.136]) by kanga.kvack.org (Postfix) with ESMTP id 13FAC8D0076 for ; Tue, 26 Jan 2021 02:38:17 -0500 (EST) Received: from smtpin21.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay05.hostedemail.com (Postfix) with ESMTP id CBED9181AF5C4 for ; Tue, 26 Jan 2021 07:38:16 +0000 (UTC) X-FDA: 77747122992.21.trip68_0a13e9a2758c Received: from filter.hostedemail.com (10.5.16.251.rfc1918.com [10.5.16.251]) by smtpin21.hostedemail.com (Postfix) with ESMTP id B0E58180442C3 for ; Tue, 26 Jan 2021 07:38:16 +0000 (UTC) X-HE-Tag: trip68_0a13e9a2758c X-Filterd-Recvd-Size: 4982 Received: from mx2.suse.de (mx2.suse.de [195.135.220.15]) by imf45.hostedemail.com (Postfix) with ESMTP for ; Tue, 26 Jan 2021 07:38:16 +0000 (UTC) X-Virus-Scanned: by amavisd-new at test-mx.suse.de DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.com; s=susede1; t=1611646694; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=M0mfPAgr5/mcN1gE3PCuv5bB2pgiXjtbaOMlL4p0sos=; b=dsN+HPpNY9OXHC9dhykB1ubNv7WY+/ssIg+VKsRreb5xETHkTsTy8aRfsyHDwwgKdOPzP0 qKyX9kw9S0Bk0tz8DxM73Y+gzQhzQ+8sLd8bNWurnabNn6pNiENZhfoXXBGczpWSztCK9H QDqCpDzJ61X1KCI15VL6J8c5NJdRVsc= Received: from relay2.suse.de (unknown [195.135.221.27]) by mx2.suse.de (Postfix) with ESMTP id BF732AE56; Tue, 26 Jan 2021 07:38:14 +0000 (UTC) Date: Tue, 26 Jan 2021 08:38:08 +0100 From: Michal Hocko To: Minchan Kim Cc: Andrew Morton , linux-mm , LKML , hyesoo.yu@samsung.com, david@redhat.com, surenb@google.com, pullip.cho@samsung.com, joaodias@google.com, hridya@google.com, john.stultz@linaro.org, sumit.semwal@linaro.org, linux-media@vger.kernel.org, devicetree@vger.kernel.org, hch@infradead.org, robh+dt@kernel.org, linaro-mm-sig@lists.linaro.org Subject: Re: [PATCH v4 1/4] mm: cma: introduce gfp flag in cma_alloc instead of no_warn Message-ID: <20210126073808.GZ827@dhcp22.suse.cz> References: <20210121175502.274391-1-minchan@kernel.org> <20210121175502.274391-2-minchan@kernel.org> <20210125130701.GF827@dhcp22.suse.cz> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: X-Bogosity: Ham, tests=bogofilter, spamicity=0.000000, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: On Mon 25-01-21 11:42:34, Minchan Kim wrote: > On Mon, Jan 25, 2021 at 02:07:01PM +0100, Michal Hocko wrote: > > On Thu 21-01-21 09:54:59, Minchan Kim wrote: > > > The upcoming patch will introduce __GFP_NORETRY semantic > > > in alloc_contig_range which is a failfast mode of the API. > > > Instead of adding a additional parameter for gfp, replace > > > no_warn with gfp flag. > > > > > > To keep old behaviors, it follows the rule below. > > > > > > no_warn gfp_flags > > > > > > false GFP_KERNEL > > > true GFP_KERNEL|__GFP_NOWARN > > > gfp & __GFP_NOWARN GFP_KERNEL | (gfp & __GFP_NOWARN) > > > > > > Reviewed-by: Suren Baghdasaryan > > > Signed-off-by: Minchan Kim > > [...] > > > diff --git a/mm/cma.c b/mm/cma.c > > > index 0ba69cd16aeb..d50627686fec 100644 > > > --- a/mm/cma.c > > > +++ b/mm/cma.c > > > @@ -419,13 +419,13 @@ static inline void cma_debug_show_areas(struct cma *cma) { } > > > * @cma: Contiguous memory region for which the allocation is performed. > > > * @count: Requested number of pages. > > > * @align: Requested alignment of pages (in PAGE_SIZE order). > > > - * @no_warn: Avoid printing message about failed allocation > > > + * @gfp_mask: GFP mask to use during the cma allocation. > > > > Call out supported gfp flags explicitly. Have a look at kvmalloc_node > > for a guidance. > > How about this? > > > diff --git a/mm/cma.c b/mm/cma.c > index d50627686fec..b94727b694d6 100644 > --- a/mm/cma.c > +++ b/mm/cma.c > @@ -423,6 +423,10 @@ static inline void cma_debug_show_areas(struct cma *cma) { } > * > * This function allocates part of contiguous memory on specific > * contiguous memory area. > + * > + * For gfp_mask, GFP_KERNEL and __GFP_NORETRY are supported. __GFP_NORETRY > + * will avoid costly functions(e.g., waiting on page_writeback and locking) > + * at current implementaion during the page migration. rather than explicitly mentioning what the flag implies I think it would be more useful to state the intended usecase. See how kvmalloc_node says "__GFP_RETRY_MAYFAIL is supported, and it should be used only if kmalloc is preferable to the vmalloc fallback, due to visible performance drawbacks. __GFP_NOWARN is also supported to suppress allocation failure messages." This would help people not familiar with internals to see whether this flag is a good fit for them. In this case I woul go with " @flags: gfp mask. Must be compatible (superset) with GFP_KERNEL. [...] Reclaim modifiers (__GFP_RETRY_MAYFAIL, __GFP_NOFAIL) are not supported. __GFP_NORETRY is supported, and it should be used for opportunistic allocation attempts that should rather fail quickly when the caller has a fallback strategy. " Obviously for this patch you will go with a simple statement that Reclaim modifiers are not supported at all. > */ > struct page *cma_alloc(struct cma *cma, size_t count, unsigned int align, > gfp_t gfp_mask) > -- Michal Hocko SUSE Labs