backports.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Hauke Mehrtens <hauke@hauke-m.de>
To: johannes@sipsolutions.net
Cc: backports@vger.kernel.org, john@phrozen.org,
	Hauke Mehrtens <hauke@hauke-m.de>
Subject: [PATCH 2/7] header: Add kzalloc()
Date: Mon, 17 Sep 2018 23:31:37 +0200	[thread overview]
Message-ID: <20180917213142.7875-2-hauke@hauke-m.de> (raw)
In-Reply-To: <20180917213142.7875-1-hauke@hauke-m.de>

This adds the kzalloc() function and allows it to remove the
lib-rhashtable.patch patch.

Signed-off-by: Hauke Mehrtens <hauke@hauke-m.de>
---
 backport/backport-include/linux/mm.h |  6 ++++++
 patches/lib-rhashtable.patch         | 18 ------------------
 2 files changed, 6 insertions(+), 18 deletions(-)
 delete mode 100644 patches/lib-rhashtable.patch

diff --git a/backport/backport-include/linux/mm.h b/backport/backport-include/linux/mm.h
index 7e69b873..38c452e2 100644
--- a/backport/backport-include/linux/mm.h
+++ b/backport/backport-include/linux/mm.h
@@ -112,6 +112,12 @@ static inline void *kvmalloc_array(size_t n, size_t size, gfp_t flags)
 
 	return kvmalloc(bytes, flags);
 }
+
+#define kvzalloc LINUX_BACKPORT(kvzalloc)
+static inline void *kvzalloc(size_t size, gfp_t flags)
+{
+	return kvmalloc(size, flags | __GFP_ZERO);
+}
 #endif
 
 #endif /* __BACKPORT_MM_H */
diff --git a/patches/lib-rhashtable.patch b/patches/lib-rhashtable.patch
deleted file mode 100644
index 2e91f8d9..00000000
--- a/patches/lib-rhashtable.patch
+++ /dev/null
@@ -1,18 +0,0 @@
-
---- a/compat/lib-rhashtable.c
-+++ b/compat/lib-rhashtable.c
-@@ -175,10 +175,11 @@ static struct bucket_table *bucket_table
- 	int i;
- 
- 	size = sizeof(*tbl) + nbuckets * sizeof(tbl->buckets[0]);
--	if (gfp != GFP_KERNEL)
-+	if (size <= (PAGE_SIZE << PAGE_ALLOC_COSTLY_ORDER) ||
-+	    gfp != GFP_KERNEL)
- 		tbl = kzalloc(size, gfp | __GFP_NOWARN | __GFP_NORETRY);
--	else
--		tbl = kvzalloc(size, gfp);
-+	if (tbl == NULL && gfp == GFP_KERNEL)
-+		tbl = vzalloc(size);
- 
- 	size = nbuckets;
- 
-- 
2.11.0

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

  reply	other threads:[~2018-09-18  3:00 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-09-17 21:31 [PATCH 1/7] backports: Remove unused parts Hauke Mehrtens
2018-09-17 21:31 ` Hauke Mehrtens [this message]
2018-09-17 21:31 ` [PATCH 3/7] patches: Adapt to new select queue API Hauke Mehrtens
2018-09-17 21:31 ` [PATCH 4/7] patches: make patches apply with kernel 4.19 Hauke Mehrtens
2018-09-17 21:31 ` [PATCH 5/7] header: Add NL_SET_BAD_ATTR Hauke Mehrtens
2018-09-17 21:31 ` [PATCH 6/7] header: Add u64_stats_update_{begin,end}_irqsave() Hauke Mehrtens
2018-09-17 21:31 ` [PATCH 7/7] header: Add ktime_get_raw_ts64() Hauke Mehrtens
2018-09-19  9:25 ` [PATCH 1/7] backports: Remove unused parts Johannes Berg

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=20180917213142.7875-2-hauke@hauke-m.de \
    --to=hauke@hauke-m.de \
    --cc=backports@vger.kernel.org \
    --cc=johannes@sipsolutions.net \
    --cc=john@phrozen.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;
as well as URLs for NNTP newsgroup(s).