From: mhocko@kernel.org (Michal Hocko)
To: linux-arm-kernel@lists.infradead.org
Subject: [PATCH] mm: cma: honor __GFP_ZERO flag in cma_alloc()
Date: Mon, 2 Jul 2018 15:32:47 +0200 [thread overview]
Message-ID: <20180702133247.GT19043@dhcp22.suse.cz> (raw)
In-Reply-To: <20180702132335eucas1p1323fbf51cd5e82a59939d72097acee04~9kAizDyji0466904669eucas1p1w@eucas1p1.samsung.com>
On Mon 02-07-18 15:23:34, Marek Szyprowski wrote:
> Hi Michal,
>
> On 2018-06-13 15:39, Michal Hocko wrote:
> > On Wed 13-06-18 05:55:46, Christoph Hellwig wrote:
> >> On Wed, Jun 13, 2018 at 02:40:00PM +0200, Marek Szyprowski wrote:
> >>> It is not only the matter of the spinlocks. GFP_ATOMIC is not supported
> >>> by the
> >>> memory compaction code, which is used in alloc_contig_range(). Right, this
> >>> should be also noted in the documentation.
> >> Documentation is good, asserts are better. The code should reject any
> >> flag not explicitly supported, or even better have its own flags type
> >> with the few actually supported flags.
> > Agreed. Is the cma allocator used for anything other than GFP_KERNEL
> > btw.? If not then, shouldn't we simply drop the gfp argument altogether
> > rather than give users a false hope for differen gfp modes that are not
> > really supported and grow broken code?
>
> Nope, all cma_alloc() callers are expected to use it with GFP_KERNEL gfp
> mask.
> The only flag which is now checked is __GFP_NOWARN. I can change the
> function
> signature of cma_alloc to:
> struct page *cma_alloc(struct cma *cma, size_t count, unsigned int
> align, bool no_warn);
Are there any __GFP_NOWARN users? I have quickly hit the indirection
trap and searching for alloc callback didn't tell me really much.
> What about clearing the allocated buffer? Should it be another bool
> parameter, done unconditionally or moved to the callers?
That really depends on callers. I have no idea what they actually ask
for.
--
Michal Hocko
SUSE Labs
WARNING: multiple messages have this Message-ID (diff)
From: Michal Hocko <mhocko@kernel.org>
To: Marek Szyprowski <m.szyprowski@samsung.com>
Cc: Christoph Hellwig <hch@infradead.org>,
Matthew Wilcox <willy@infradead.org>,
linux-mm@kvack.org, linux-kernel@vger.kernel.org,
linux-arm-kernel@lists.infradead.org,
Andrew Morton <akpm@linux-foundation.org>,
Michal Nazarewicz <mina86@mina86.com>,
Joonsoo Kim <iamjoonsoo.kim@lge.com>,
Vlastimil Babka <vbabka@suse.cz>
Subject: Re: [PATCH] mm: cma: honor __GFP_ZERO flag in cma_alloc()
Date: Mon, 2 Jul 2018 15:32:47 +0200 [thread overview]
Message-ID: <20180702133247.GT19043@dhcp22.suse.cz> (raw)
In-Reply-To: <20180702132335eucas1p1323fbf51cd5e82a59939d72097acee04~9kAizDyji0466904669eucas1p1w@eucas1p1.samsung.com>
On Mon 02-07-18 15:23:34, Marek Szyprowski wrote:
> Hi Michal,
>
> On 2018-06-13 15:39, Michal Hocko wrote:
> > On Wed 13-06-18 05:55:46, Christoph Hellwig wrote:
> >> On Wed, Jun 13, 2018 at 02:40:00PM +0200, Marek Szyprowski wrote:
> >>> It is not only the matter of the spinlocks. GFP_ATOMIC is not supported
> >>> by the
> >>> memory compaction code, which is used in alloc_contig_range(). Right, this
> >>> should be also noted in the documentation.
> >> Documentation is good, asserts are better. The code should reject any
> >> flag not explicitly supported, or even better have its own flags type
> >> with the few actually supported flags.
> > Agreed. Is the cma allocator used for anything other than GFP_KERNEL
> > btw.? If not then, shouldn't we simply drop the gfp argument altogether
> > rather than give users a false hope for differen gfp modes that are not
> > really supported and grow broken code?
>
> Nope, all cma_alloc() callers are expected to use it with GFP_KERNEL gfp
> mask.
> The only flag which is now checked is __GFP_NOWARN. I can change the
> function
> signature of cma_alloc to:
> struct page *cma_alloc(struct cma *cma, size_t count, unsigned int
> align, bool no_warn);
Are there any __GFP_NOWARN users? I have quickly hit the indirection
trap and searching for alloc callback didn't tell me really much.
> What about clearing the allocated buffer? Should it be another bool
> parameter, done unconditionally or moved to the callers?
That really depends on callers. I have no idea what they actually ask
for.
--
Michal Hocko
SUSE Labs
next prev parent reply other threads:[~2018-07-02 13:32 UTC|newest]
Thread overview: 22+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <CGME20180613085851eucas1p20337d050face8ff8ea87674e16a9ccd2@eucas1p2.samsung.com>
2018-06-13 8:58 ` [PATCH] mm: cma: honor __GFP_ZERO flag in cma_alloc() Marek Szyprowski
2018-06-13 8:58 ` Marek Szyprowski
2018-06-13 12:24 ` Matthew Wilcox
2018-06-13 12:24 ` Matthew Wilcox
2018-06-13 12:40 ` Marek Szyprowski
2018-06-13 12:40 ` Marek Szyprowski
2018-06-13 12:55 ` Christoph Hellwig
2018-06-13 12:55 ` Christoph Hellwig
2018-06-13 13:39 ` Michal Hocko
2018-06-13 13:39 ` Michal Hocko
2018-07-02 13:23 ` Marek Szyprowski
2018-07-02 13:23 ` Marek Szyprowski
2018-07-02 13:30 ` Christoph Hellwig
2018-07-02 13:30 ` Christoph Hellwig
2018-07-09 10:32 ` Marek Szyprowski
2018-07-09 10:32 ` Marek Szyprowski
2018-07-02 13:32 ` Michal Hocko [this message]
2018-07-02 13:32 ` Michal Hocko
2018-07-09 10:31 ` Marek Szyprowski
2018-07-09 10:31 ` Marek Szyprowski
2018-06-13 12:52 ` Christoph Hellwig
2018-06-13 12:52 ` Christoph Hellwig
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20180702133247.GT19043@dhcp22.suse.cz \
--to=mhocko@kernel.org \
--cc=linux-arm-kernel@lists.infradead.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.