From: Kees Cook <keescook@chromium.org>
To: Michal Hocko <mhocko@kernel.org>
Cc: Andrew Morton <akpm@linux-foundation.org>,
Vlastimil Babka <vbabka@suse.cz>,
David Rientjes <rientjes@google.com>,
Mel Gorman <mgorman@suse.de>,
Johannes Weiner <hannes@cmpxchg.org>,
Al Viro <viro@zeniv.linux.org.uk>, Linux-MM <linux-mm@kvack.org>,
LKML <linux-kernel@vger.kernel.org>,
Michal Hocko <mhocko@suse.com>,
Martin Schwidefsky <schwidefsky@de.ibm.com>,
Heiko Carstens <heiko.carstens@de.ibm.com>,
Herbert Xu <herbert@gondor.apana.org.au>,
Anton Vorontsov <anton@enomsg.org>,
Colin Cross <ccross@android.com>, Tony Luck <tony.luck@intel.com>,
"Rafael J. Wysocki" <rjw@rjwysocki.net>,
Ben Skeggs <bskeggs@redhat.com>,
Kent Overstreet <kent.overstreet@gmail.com>,
Santosh Raspatur <santosh@chelsio.com>,
Hariprasad S <hariprasad@chelsio.com>,
Yishai Hadas <yishaih@mellanox.com>,
Oleg Drokin <oleg.drokin@intel.com>,
"Yan, Zheng" <zyan@redhat.com>,
Alexei Starovoitov <ast@kernel.org>,
Eric Dumazet <eric.dumazet@gmail.com>,
Network Development <netdev@vger.kernel.org>
Subject: Re: [PATCH 5/9] treewide: use kv[mz]alloc* rather than opencoded variants
Date: Mon, 30 Jan 2017 11:24:02 -0800 [thread overview]
Message-ID: <CAGXu5jLFwQuUyZuRuK60YBGYbbEkt+C3dKxCyDe65Ad5co2oLw@mail.gmail.com> (raw)
In-Reply-To: <20170130094940.13546-6-mhocko@kernel.org>
On Mon, Jan 30, 2017 at 1:49 AM, Michal Hocko <mhocko@kernel.org> wrote:
> From: Michal Hocko <mhocko@suse.com>
>
> There are many code paths opencoding kvmalloc. Let's use the helper
> instead. The main difference to kvmalloc is that those users are usually
> not considering all the aspects of the memory allocator. E.g. allocation
> requests <= 32kB (with 4kB pages) are basically never failing and invoke
> OOM killer to satisfy the allocation. This sounds too disruptive for
> something that has a reasonable fallback - the vmalloc. On the other
> hand those requests might fallback to vmalloc even when the memory
> allocator would succeed after several more reclaim/compaction attempts
> previously. There is no guarantee something like that happens though.
>
> This patch converts many of those places to kv[mz]alloc* helpers because
> they are more conservative.
>
> Changes since v1
> - add kvmalloc_array - this might silently fix some overflow issues
> because most users simply didn't check the overflow for the vmalloc
> fallback.
Awesome, thanks for adding that API. :)
Acked-by: Kees Cook <keescook@chromium.org>
-Kees
--
Kees Cook
Nexus Security
--
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-30 19:24 UTC|newest]
Thread overview: 23+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-01-30 9:49 [PATCH 0/6 v3] kvmalloc Michal Hocko
2017-01-30 9:49 ` [PATCH 1/9] mm: introduce kv[mz]alloc helpers Michal Hocko
2017-01-30 9:49 ` [PATCH 2/9] mm: support __GFP_REPEAT in kvmalloc_node for >32kB Michal Hocko
2017-01-30 9:49 ` [PATCH 3/9] rhashtable: simplify a strange allocation pattern Michal Hocko
2017-01-30 14:04 ` Vlastimil Babka
2017-01-30 9:49 ` [PATCH 4/9] ila: " Michal Hocko
2017-01-30 15:21 ` Vlastimil Babka
2017-01-30 9:49 ` [PATCH 5/9] treewide: use kv[mz]alloc* rather than opencoded variants Michal Hocko
2017-01-30 10:21 ` Leon Romanovsky
2017-01-30 16:14 ` Vlastimil Babka
2017-01-30 19:24 ` Kees Cook [this message]
2017-01-30 9:49 ` [PATCH 6/9] net: use kvmalloc with __GFP_REPEAT rather than open coded variant Michal Hocko
2017-01-30 16:36 ` Vlastimil Babka
2017-01-30 9:49 ` [PATCH 7/9] md: use kvmalloc rather than opencoded variant Michal Hocko
2017-01-30 16:42 ` Vlastimil Babka
2017-02-01 17:29 ` Mikulas Patocka
2017-02-01 17:58 ` Michal Hocko
2017-01-30 9:49 ` [PATCH 8/9] bcache: use kvmalloc Michal Hocko
2017-01-30 16:47 ` Vlastimil Babka
2017-01-30 17:25 ` Michal Hocko
2017-01-30 9:49 ` [PATCH 9/9] net, bpf: use kvzalloc helper Michal Hocko
2017-01-30 17:20 ` Michal Hocko
2017-02-05 10:23 ` [PATCH 0/6 v3] kvmalloc 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=CAGXu5jLFwQuUyZuRuK60YBGYbbEkt+C3dKxCyDe65Ad5co2oLw@mail.gmail.com \
--to=keescook@chromium.org \
--cc=akpm@linux-foundation.org \
--cc=anton@enomsg.org \
--cc=ast@kernel.org \
--cc=bskeggs@redhat.com \
--cc=ccross@android.com \
--cc=eric.dumazet@gmail.com \
--cc=hannes@cmpxchg.org \
--cc=hariprasad@chelsio.com \
--cc=heiko.carstens@de.ibm.com \
--cc=herbert@gondor.apana.org.au \
--cc=kent.overstreet@gmail.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-mm@kvack.org \
--cc=mgorman@suse.de \
--cc=mhocko@kernel.org \
--cc=mhocko@suse.com \
--cc=netdev@vger.kernel.org \
--cc=oleg.drokin@intel.com \
--cc=rientjes@google.com \
--cc=rjw@rjwysocki.net \
--cc=santosh@chelsio.com \
--cc=schwidefsky@de.ibm.com \
--cc=tony.luck@intel.com \
--cc=vbabka@suse.cz \
--cc=viro@zeniv.linux.org.uk \
--cc=yishaih@mellanox.com \
--cc=zyan@redhat.com \
/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;
as well as URLs for NNTP newsgroup(s).