linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
From: Chengming Zhou <chengming.zhou@linux.dev>
To: Andrew Morton <akpm@linux-foundation.org>,
	 David Hildenbrand <david@redhat.com>,
	Stefan Roesch <shr@devkernel.io>,  xu xin <xu.xin16@zte.com.cn>
Cc: linux-mm@kvack.org, linux-kernel@vger.kernel.org,
	 zhouchengming@bytedance.com,
	Chengming Zhou <chengming.zhou@linux.dev>
Subject: [PATCH 3/4] mm/ksm: union hlist_node with list_head in struct ksm_stable_node
Date: Wed, 08 May 2024 17:55:40 +0800	[thread overview]
Message-ID: <20240508-b4-ksm-counters-v1-3-e2a9b13f70c5@linux.dev> (raw)
In-Reply-To: <20240508-b4-ksm-counters-v1-0-e2a9b13f70c5@linux.dev>

The ksm_stable_node->hlist_node is used for linking on chain node hlist,
and ksm_stable_node->list_head is used for linking on migration list.

We always stable_node_dup_del() first before adding it on migration list
or list_del() first from migration list before adding it on stable tree.

So we can union hlist_node with list_head to save some memory.

Signed-off-by: Chengming Zhou <chengming.zhou@linux.dev>
---
 mm/ksm.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/mm/ksm.c b/mm/ksm.c
index 6e0dca3cecf3..87ffd228944c 100644
--- a/mm/ksm.c
+++ b/mm/ksm.c
@@ -162,7 +162,7 @@ struct ksm_stable_node {
 		struct rb_node node;	/* when node of stable tree */
 		struct {		/* when listed for migration */
 			struct list_head *head;
-			struct {
+			union {
 				struct hlist_node hlist_dup;
 				struct list_head list;
 			};

-- 
2.45.0



  parent reply	other threads:[~2024-05-08  9:56 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-05-08  9:55 [PATCH 0/4] mm/ksm: fix some accounting problems Chengming Zhou
2024-05-08  9:55 ` [PATCH 1/4] mm/ksm: fix ksm_pages_scanned accounting Chengming Zhou
2024-05-08 10:35   ` Chengming Zhou
2024-05-08 12:32     ` David Hildenbrand
2024-05-08  9:55 ` [PATCH 2/4] mm/ksm: fix ksm_zero_pages accounting Chengming Zhou
2024-05-08 10:37   ` Chengming Zhou
2024-05-08 12:36   ` David Hildenbrand
2024-05-08 13:52     ` Chengming Zhou
2024-05-08  9:55 ` Chengming Zhou [this message]
2024-05-08  9:55 ` [PATCH 4/4] mm/ksm: calculate general_profit more accurately Chengming Zhou
2024-05-08 10:24 ` [PATCH 0/4] mm/ksm: fix some accounting problems David Hildenbrand
2024-05-08 10:28   ` Chengming Zhou

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=20240508-b4-ksm-counters-v1-3-e2a9b13f70c5@linux.dev \
    --to=chengming.zhou@linux.dev \
    --cc=akpm@linux-foundation.org \
    --cc=david@redhat.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mm@kvack.org \
    --cc=shr@devkernel.io \
    --cc=xu.xin16@zte.com.cn \
    --cc=zhouchengming@bytedance.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