From: Qi Zheng <zhengqi.arch@bytedance.com>
To: akpm@linux-foundation.org, shy828301@gmail.com,
willy@infradead.org, vbabka@suse.cz, hannes@cmpxchg.org,
minchan@kernel.org, rppt@kernel.org
Cc: linux-mm@kvack.org, linux-kernel@vger.kernel.org,
Qi Zheng <zhengqi.arch@bytedance.com>
Subject: [PATCH v2 6/7] ksm: convert ksm_mm_slot.link to ksm_mm_slot.hash
Date: Wed, 31 Aug 2022 11:19:50 +0800 [thread overview]
Message-ID: <20220831031951.43152-7-zhengqi.arch@bytedance.com> (raw)
In-Reply-To: <20220831031951.43152-1-zhengqi.arch@bytedance.com>
In order to use common struct mm_slot, convert ksm_mm_slot.link
to ksm_mm_slot.hash in advance, no functional change.
Signed-off-by: Qi Zheng <zhengqi.arch@bytedance.com>
---
mm/ksm.c | 14 +++++++-------
1 file changed, 7 insertions(+), 7 deletions(-)
diff --git a/mm/ksm.c b/mm/ksm.c
index 8c52aa7e0a02..667efca75b0d 100644
--- a/mm/ksm.c
+++ b/mm/ksm.c
@@ -113,13 +113,13 @@
/**
* struct ksm_mm_slot - ksm information per mm that is being scanned
- * @link: link to the mm_slots hash list
+ * @hash: link to the mm_slots hash list
* @mm_node: link into the mm_slots list, rooted in ksm_mm_head
* @rmap_list: head for this mm_slot's singly-linked list of rmap_items
* @mm: the mm that this information is valid for
*/
struct ksm_mm_slot {
- struct hlist_node link;
+ struct hlist_node hash;
struct list_head mm_node;
struct ksm_rmap_item *rmap_list;
struct mm_struct *mm;
@@ -424,7 +424,7 @@ static struct ksm_mm_slot *get_mm_slot(struct mm_struct *mm)
{
struct ksm_mm_slot *slot;
- hash_for_each_possible(mm_slots_hash, slot, link, (unsigned long)mm)
+ hash_for_each_possible(mm_slots_hash, slot, hash, (unsigned long)mm)
if (slot->mm == mm)
return slot;
@@ -435,7 +435,7 @@ static void insert_to_mm_slots_hash(struct mm_struct *mm,
struct ksm_mm_slot *mm_slot)
{
mm_slot->mm = mm;
- hash_add(mm_slots_hash, &mm_slot->link, (unsigned long)mm);
+ hash_add(mm_slots_hash, &mm_slot->hash, (unsigned long)mm);
}
/*
@@ -1008,7 +1008,7 @@ static int unmerge_and_remove_all_rmap_items(void)
ksm_scan.mm_slot = list_entry(mm_slot->mm_node.next,
struct ksm_mm_slot, mm_node);
if (ksm_test_exit(mm)) {
- hash_del(&mm_slot->link);
+ hash_del(&mm_slot->hash);
list_del(&mm_slot->mm_node);
spin_unlock(&ksm_mmlist_lock);
@@ -2376,7 +2376,7 @@ static struct ksm_rmap_item *scan_get_next_rmap_item(struct page **page)
* or when all VM_MERGEABLE areas have been unmapped (and
* mmap_lock then protects against race with MADV_MERGEABLE).
*/
- hash_del(&slot->link);
+ hash_del(&slot->hash);
list_del(&slot->mm_node);
spin_unlock(&ksm_mmlist_lock);
@@ -2570,7 +2570,7 @@ void __ksm_exit(struct mm_struct *mm)
mm_slot = get_mm_slot(mm);
if (mm_slot && ksm_scan.mm_slot != mm_slot) {
if (!mm_slot->rmap_list) {
- hash_del(&mm_slot->link);
+ hash_del(&mm_slot->hash);
list_del(&mm_slot->mm_node);
easy_to_free = 1;
} else {
--
2.20.1
next prev parent reply other threads:[~2022-08-31 3:20 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-08-31 3:19 [PATCH v2 0/7] add common struct mm_slot and use it in THP and KSM Qi Zheng
2022-08-31 3:19 ` [PATCH v2 1/7] mm: introduce common struct mm_slot Qi Zheng
2022-08-31 3:19 ` [PATCH v2 2/7] mm: thp: convert to use " Qi Zheng
2022-09-01 7:44 ` [PATCH mm-unstable] mm: thp: fix build error with CONFIG_SHMEM disabled Qi Zheng
2022-08-31 3:19 ` [PATCH v2 3/7] ksm: remove redundant declarations in ksm.h Qi Zheng
2022-08-31 3:19 ` [PATCH v2 4/7] ksm: add the ksm prefix to the names of the ksm private structures Qi Zheng
2022-08-31 3:19 ` [PATCH v2 5/7] ksm: convert ksm_mm_slot.mm_list to ksm_mm_slot.mm_node Qi Zheng
2022-08-31 3:19 ` Qi Zheng [this message]
2022-08-31 3:19 ` [PATCH v2 7/7] ksm: convert to use common struct mm_slot Qi Zheng
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=20220831031951.43152-7-zhengqi.arch@bytedance.com \
--to=zhengqi.arch@bytedance.com \
--cc=akpm@linux-foundation.org \
--cc=hannes@cmpxchg.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-mm@kvack.org \
--cc=minchan@kernel.org \
--cc=rppt@kernel.org \
--cc=shy828301@gmail.com \
--cc=vbabka@suse.cz \
--cc=willy@infradead.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