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=-13.8 required=3.0 tests=BAYES_00,DKIM_INVALID, DKIM_SIGNED,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 906E8C433DB for ; Wed, 27 Jan 2021 20:21:52 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id 225CB61488 for ; Wed, 27 Jan 2021 20:21:51 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 225CB61488 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=kernel.org Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=owner-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix) id 5D4456B0006; Wed, 27 Jan 2021 15:21:51 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id 5ABCF6B006C; Wed, 27 Jan 2021 15:21:51 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 49AD96B006E; Wed, 27 Jan 2021 15:21:51 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0180.hostedemail.com [216.40.44.180]) by kanga.kvack.org (Postfix) with ESMTP id 127F96B0006 for ; Wed, 27 Jan 2021 15:21:51 -0500 (EST) Received: from smtpin01.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay02.hostedemail.com (Postfix) with ESMTP id 60CB5363E for ; Wed, 27 Jan 2021 20:21:50 +0000 (UTC) X-FDA: 77752675980.01.space25_620c59e27599 Received: from filter.hostedemail.com (10.5.16.251.rfc1918.com [10.5.16.251]) by smtpin01.hostedemail.com (Postfix) with ESMTP id 481141004D430 for ; Wed, 27 Jan 2021 20:21:50 +0000 (UTC) X-HE-Tag: space25_620c59e27599 X-Filterd-Recvd-Size: 7256 Received: from mail-pl1-f177.google.com (mail-pl1-f177.google.com [209.85.214.177]) by imf31.hostedemail.com (Postfix) with ESMTP for ; Wed, 27 Jan 2021 20:21:49 +0000 (UTC) Received: by mail-pl1-f177.google.com with SMTP id r4so1659699pls.11 for ; Wed, 27 Jan 2021 12:21:49 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=sender:date:from:to:cc:subject:message-id:references:mime-version :content-disposition:in-reply-to; bh=+hzofQqaeoGNYCe45SBnaGoQ2vMeZ0xTF87uPiMOHFo=; b=ehBqk2cKFP47FSh36lcKYdIQ7FQwNm+nWdue8RxJbzWMUDAsaBzIw3U3jmpjsZJGkS ADstB+JqPho4IupDRfsSOw5Hl6xIbeTGLZZCv4sH7rQZ/DPQg224Bl6SC7wEoi1nHYey zYHmTKWyfCTKEV+CQVSVrcrh9zo1YhZfngT/ZVfQxH3MFtK1sPPPF+HrlyFCsy5XgunE PKqizqhUh1jIasQqbbZ0H/D8Efz6/A38i45XpNorFHZ/qKqC+7GsNS8Swe6/GRyuJZ85 9HUqdcgjWgFDqqy+Pb6LKRZDqnDkD1lpJHuDppM3Ny2QImP9KIORvH7UA+UbdUssVNHW r1jw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:sender:date:from:to:cc:subject:message-id :references:mime-version:content-disposition:in-reply-to; bh=+hzofQqaeoGNYCe45SBnaGoQ2vMeZ0xTF87uPiMOHFo=; b=LOK0M4jPSibTCYZHVzkHJVK6RArw0nO1NBWpoDfy6vTbycIUxxZtaRz3LgLAahop3o U5ZhKme/3mVbKkM0BlKiIw7nEhKxeic0RVVH4jBt6jNlBFl9TLmoZtg1TMsPd3RJ1bkN nhmv4t66PlIMasJuuKtWQM+88CB6C+W13i2KUEEkyj2qziiwHgkR4TAsQi9vi1UJzZxN eQ6Aq5RLiLfvEGU3qtMBGQTAgoVftC3X3FB83qlF6bR/D8uHPN0WYXVtsZ/iufxIT/db FN3A5qlYOg1bKUw7ZTcYk7O6aEKymtgOB8Mbp1RU/4hFtl4feyolx8X1JOkpnxRCqYtY CX4w== X-Gm-Message-State: AOAM531/H9bhuGBnZ6740JROecsCGWp7NCNfvYl6SvSgatyWSB33uCzB I0ND1jPtA61xxK2vsVSZO78= X-Google-Smtp-Source: ABdhPJy2tnLBcvXAqOMHFbdOndQtX/tERTcINJmus1YbktB7wIePSj3Rx/TdqMimPIXysMbx4hTg3w== X-Received: by 2002:a17:902:a412:b029:db:cf5a:8427 with SMTP id p18-20020a170902a412b02900dbcf5a8427mr12888916plq.48.1611778908549; Wed, 27 Jan 2021 12:21:48 -0800 (PST) Received: from google.com ([2620:15c:211:201:9dd5:b47b:bb84:dede]) by smtp.gmail.com with ESMTPSA id e17sm2863806pjh.39.2021.01.27.12.21.46 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 27 Jan 2021 12:21:47 -0800 (PST) Date: Wed, 27 Jan 2021 12:21:45 -0800 From: Minchan Kim To: Michal Hocko 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: References: <20210121175502.274391-1-minchan@kernel.org> <20210121175502.274391-2-minchan@kernel.org> <20210125130701.GF827@dhcp22.suse.cz> <20210126073808.GZ827@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 Tue, Jan 26, 2021 at 11:12:14AM -0800, Minchan Kim wrote: > On Tue, Jan 26, 2021 at 08:38:08AM +0100, Michal Hocko wrote: > > 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. > > After more discussion for gfp_flags in thread of next patch, let me > changes a bit more based on it. > > Thanks for the suggestion, Michal. Based on the discussion in other thread, I want to go with __GFP_NORETRY to indicate "opportunistic-easy-to-fail attempt" so suggestion words Michal is valid so I will carry it on next version. Thank you.