All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] backport: add some new kv[mz]alloc function
@ 2017-07-21  6:55 AceLan Kao
  2017-07-21 13:21 ` Luca Coelho
  2017-09-06 22:05 ` Hauke Mehrtens
  0 siblings, 2 replies; 7+ messages in thread
From: AceLan Kao @ 2017-07-21  6:55 UTC (permalink / raw)
  To: hauke, mcgrof, backports

add some new kv[mz]alloc functions which introduced after v4.12
by this commit

commit a7c3e901a46ff54c016d040847eda598a9e3e653
Author: Michal Hocko <mhocko@suse.com>
Date:   Mon May 8 15:57:09 2017 -0700

    mm: introduce kv[mz]alloc helpers

Signed-off-by: AceLan Kao <acelan.kao@canonical.com>
---
 backport/backport-include/linux/mm.h | 16 ++++++++++++++++
 1 file changed, 16 insertions(+)

diff --git a/backport/backport-include/linux/mm.h b/backport/backport-include/linux/mm.h
index 3234b37..8125310 100644
--- a/backport/backport-include/linux/mm.h
+++ b/backport/backport-include/linux/mm.h
@@ -123,4 +123,20 @@ static inline bool page_is_pfmemalloc(struct page *page)
 }
 #endif /* < 4.2 */
 
+#if LINUX_VERSION_IS_LESS(4,12,0)
+extern void *kvmalloc_node(size_t size, gfp_t flags, int node);
+static inline void *kvmalloc(size_t size, gfp_t flags)
+{
+	return kvmalloc_node(size, flags, NUMA_NO_NODE);
+}
+static inline void *kvzalloc_node(size_t size, gfp_t flags, int node)
+{
+	return kvmalloc_node(size, flags | __GFP_ZERO, node);
+}
+static inline void *kvzalloc(size_t size, gfp_t flags)
+{
+	return kvmalloc(size, flags | __GFP_ZERO);
+}
+#endif /* < 4.12.0 */
+
 #endif /* __BACKPORT_MM_H */
-- 
2.7.4

--
To unsubscribe from this list: send the line "unsubscribe backports" in

^ permalink raw reply related	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2017-09-07  2:47 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-07-21  6:55 [PATCH] backport: add some new kv[mz]alloc function AceLan Kao
2017-07-21 13:21 ` Luca Coelho
2017-07-22  7:52   ` Arend van Spriel
2017-07-22 11:29     ` Luca Coelho
2017-07-24  2:40       ` AceLan Kao
2017-09-06 22:05 ` Hauke Mehrtens
2017-09-07  2:47   ` AceLan Kao

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.