[PATCH 3/4] mm/ksm: union hlist_node with list_head in struct ksm_stable_node

Chengming Zhou posted 4 patches 1 year, 7 months ago
There is a newer version of this series
[PATCH 3/4] mm/ksm: union hlist_node with list_head in struct ksm_stable_node
Posted by Chengming Zhou 1 year, 7 months ago
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