linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
From: Miaohe Lin <linmiaohe@huawei.com>
To: <akpm@linux-foundation.org>, <sjenning@redhat.com>, <ddstreet@ieee.org>
Cc: <linux-kernel@vger.kernel.org>, <linux-mm@kvack.org>,
	<linmiaohe@huawei.com>
Subject: [PATCH v2 1/2] mm/zbud: reuse unbuddied[0] as buddied in zbud_pool
Date: Tue, 8 Jun 2021 19:45:14 +0800	[thread overview]
Message-ID: <20210608114515.206992-2-linmiaohe@huawei.com> (raw)
In-Reply-To: <20210608114515.206992-1-linmiaohe@huawei.com>

Since commit 9d8c5b5284e4 ("mm: zbud: fix condition check on allocation
size"), zbud_pool.unbuddied[0] is always unused. We can reuse it as buddied
field to save some possible memory.

Signed-off-by: Miaohe Lin <linmiaohe@huawei.com>
---
 mm/zbud.c | 10 ++++++++--
 1 file changed, 8 insertions(+), 2 deletions(-)

diff --git a/mm/zbud.c b/mm/zbud.c
index a200121da400..78e80ca58869 100644
--- a/mm/zbud.c
+++ b/mm/zbud.c
@@ -95,8 +95,14 @@
  */
 struct zbud_pool {
 	spinlock_t lock;
-	struct list_head unbuddied[NCHUNKS];
-	struct list_head buddied;
+	union {
+		/*
+		 * Reuse unbuddied[0] as buddied on the ground that
+		 * unbuddied[0] is unused.
+		 */
+		struct list_head buddied;
+		struct list_head unbuddied[NCHUNKS];
+	};
 	struct list_head lru;
 	u64 pages_nr;
 	const struct zbud_ops *ops;
-- 
2.23.0



  reply	other threads:[~2021-06-08 11:46 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-06-08 11:45 [PATCH v2 0/2] Cleanups for zbud Miaohe Lin
2021-06-08 11:45 ` Miaohe Lin [this message]
2021-06-08 11:45 ` [PATCH v2 2/2] mm/zbud: don't export any zbud API Miaohe Lin
2021-06-18  0:44   ` Nathan Chancellor
2021-06-18  2:28     ` Miaohe Lin
2021-06-18  2:42       ` Nathan Chancellor
2021-06-18  2:52         ` Miaohe Lin

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=20210608114515.206992-2-linmiaohe@huawei.com \
    --to=linmiaohe@huawei.com \
    --cc=akpm@linux-foundation.org \
    --cc=ddstreet@ieee.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mm@kvack.org \
    --cc=sjenning@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