From: Tetsuo Handa <penguin-kernel@I-love.SAKURA.ne.jp>
To: Michal Hocko <mhocko@kernel.org>
Cc: Andrew Morton <akpm@linux-foundation.org>,
linux-mm@kvack.org, linux-bcache@vger.kernel.org,
kent.overstreet@gmail.com
Subject: Re: [PATCH] mm: introduce kv[mz]alloc helpers
Date: Thu, 5 Jan 2017 19:40:10 +0900 [thread overview]
Message-ID: <05308767-7f1b-6c4d-12d7-3dfcb94376c5@I-love.SAKURA.ne.jp> (raw)
In-Reply-To: <20170104142022.GL25453@dhcp22.suse.cz>
On 2017/01/04 23:20, Michal Hocko wrote:
> OK, so I've checked the open coded implementations and converted most of
> them. There are few which are either confused and need some special
> handling or need double checking.
>
> diff --git a/drivers/md/bcache/util.h b/drivers/md/bcache/util.h
> index cf2cbc211d83..9dc0f0ff0321 100644
> --- a/drivers/md/bcache/util.h
> +++ b/drivers/md/bcache/util.h
> @@ -44,10 +44,7 @@ struct closure;
> (heap)->size = (_size); \
> _bytes = (heap)->size * sizeof(*(heap)->data); \
> (heap)->data = NULL; \
> - if (_bytes < KMALLOC_MAX_SIZE) \
> - (heap)->data = kmalloc(_bytes, (gfp)); \
> - if ((!(heap)->data) && ((gfp) & GFP_KERNEL)) \
> - (heap)->data = vmalloc(_bytes); \
> + (heap)->data = kvmalloc(_bytes, (gfp) & GFP_KERNEL); \
> (heap)->data; \
> })
>
> @@ -138,10 +135,7 @@ do { \
> (fifo)->front = (fifo)->back = 0; \
> (fifo)->data = NULL; \
> \
> - if (_bytes < KMALLOC_MAX_SIZE) \
> - (fifo)->data = kmalloc(_bytes, (gfp)); \
> - if ((!(fifo)->data) && ((gfp) & GFP_KERNEL)) \
> - (fifo)->data = vmalloc(_bytes); \
> + (fifo)->data = kvmalloc(_bytes, (gfp) & GFP_KERNEL); \
> (fifo)->data; \
> })
These macros are doing strange checks.
((gfp) & GFP_KERNEL) means any bit in GFP_KERNEL is set.
((gfp) & GFP_KERNEL) == GFP_KERNEL might make sense. Actually,
all callers seems to be passing GFP_KERNEL to these macros.
Kent, how do you want to correct this? You want to apply
a patch that removes gfp argument before applying this patch?
Or, you want Michal to directly overwrite by this patch?
Michal, "(fifo)->data = NULL;" line will become redundant
and "(gfp) & GFP_KERNEL" will become "GFP_KERNEL".
--
To unsubscribe, send a message with 'unsubscribe linux-mm' in
the body to majordomo@kvack.org. For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"dont@kvack.org"> email@kvack.org </a>
next prev parent reply other threads:[~2017-01-05 10:40 UTC|newest]
Thread overview: 17+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-01-02 13:37 Michal Hocko
2017-01-02 15:55 ` Joe Perches
2017-01-02 16:02 ` Michal Hocko
2017-01-03 10:23 ` Vlastimil Babka
2017-01-03 10:33 ` Michal Hocko
2017-01-04 14:20 ` Michal Hocko
2017-01-05 10:40 ` Tetsuo Handa [this message]
2017-01-05 10:59 ` Michal Hocko
2017-01-06 14:54 ` Kent Overstreet
2017-01-06 14:36 ` Vlastimil Babka
2017-01-06 15:10 ` Michal Hocko
2017-01-04 18:12 ` [PATCH] mm: support __GFP_REPEAT in kvmalloc_node Michal Hocko
2017-01-06 12:09 ` Vlastimil Babka
2017-01-06 12:31 ` Michal Hocko
2017-01-09 8:50 ` Michal Hocko
2017-01-06 13:29 ` [PATCH] mm: introduce kv[mz]alloc helpers Vlastimil Babka
2017-01-06 13:34 ` Michal Hocko
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=05308767-7f1b-6c4d-12d7-3dfcb94376c5@I-love.SAKURA.ne.jp \
--to=penguin-kernel@i-love.sakura.ne.jp \
--cc=akpm@linux-foundation.org \
--cc=kent.overstreet@gmail.com \
--cc=linux-bcache@vger.kernel.org \
--cc=linux-mm@kvack.org \
--cc=mhocko@kernel.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox