From patchwork Mon Aug 29 14:30:54 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Qi Zheng X-Patchwork-Id: 12957992 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by smtp.lore.kernel.org (Postfix) with ESMTP id 842A2ECAAD2 for ; Mon, 29 Aug 2022 14:32:37 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 1A90294000F; Mon, 29 Aug 2022 10:32:37 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 159C3940009; Mon, 29 Aug 2022 10:32:37 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id EEDFF94000F; Mon, 29 Aug 2022 10:32:36 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0017.hostedemail.com [216.40.44.17]) by kanga.kvack.org (Postfix) with ESMTP id E0B52940009 for ; Mon, 29 Aug 2022 10:32:36 -0400 (EDT) Received: from smtpin08.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay08.hostedemail.com (Postfix) with ESMTP id B5190140BE8 for ; Mon, 29 Aug 2022 14:32:36 +0000 (UTC) X-FDA: 79852871112.08.0334B46 Received: from mail-pf1-f170.google.com (mail-pf1-f170.google.com [209.85.210.170]) by imf22.hostedemail.com (Postfix) with ESMTP id 64877C0038 for ; Mon, 29 Aug 2022 14:32:36 +0000 (UTC) Received: by mail-pf1-f170.google.com with SMTP id p185so8335852pfb.13 for ; Mon, 29 Aug 2022 07:32:36 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bytedance-com.20210112.gappssmtp.com; s=20210112; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc; bh=Al2MAS+95n2CdX2+DzZ9586scn02KUFSxAEU+wkQoAw=; b=zJ+WkTEw5T7kLlCpDfJxak9jUJkFXoBvWK5j5/jlQYN6uH1WdcOhN1Nlqg1qKCKxmH SfRyRZqZxAGobuXACaRF9H0k4t/ySb17PxBsX/Swi0QfDAO4C6okRPNJJK8qPQ7VXadJ Y1inRNK0oRY17BKmLqg/pjPfvfpl5z3LigO7GtNEr5m/hvjk8dZIXKM5JmpViFFisNSA cLHUt9Lr1HEbyT4HjWE+zQGzs1EPoPb5ML0HLbyJHDhccKs5mpHzF9BBHLTWHPK0Kn7R Dz+D7F4vpMyVXjhuh8QXl28r9WyHjLHb9yjR39oeY1rwWAL5zQmat4MnqH4nfO1/fzJ5 ZB+g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc; bh=Al2MAS+95n2CdX2+DzZ9586scn02KUFSxAEU+wkQoAw=; b=faEil6MiA7gcsi8+NElUyRbPMiZSx0IpJHJHowkz3sRfOw2gTRZZDAKFpVTH2eCChC SJeA6lb0RBe6pZ9/ElHzebfVMwQ9AWIXIApzDlzmXeo6mo+u+KYTIg9TxwHtahT7D4Pj nq+P3+gfa/WH3AS7K6dlyEAtytKFi1bi/3lrd8oEqG3o+jHOuMjNWsh1Xaufz7KtHqkP ulljpR7620fI4x26RHQz/ds8NTmlHc0Vnun5e2smb971tPjwQ18Gt1BVqpiiqKtmfwUF keF2IBXa2Il/9MWriUenTXvkutHr9CkLMn+KNrjB6SM2EBYIVm7uZiqxvCuACsYvamtY LEjw== X-Gm-Message-State: ACgBeo3wZ3piFwlXa3NhIuRWxtq3ZyhHX2wgBVr7vYy1kYteOgr/XyCI CStUz9tYn/AuM0/KRDzf3XUgcg== X-Google-Smtp-Source: AA6agR6enaQIpg1cfNwmQIexnrDT7xtacCPJiHAYbrU9RstdIo3faPfkcAg08PEC4oyvK+Rk+S7uGA== X-Received: by 2002:a62:1910:0:b0:537:d68e:3a27 with SMTP id 16-20020a621910000000b00537d68e3a27mr14488781pfz.71.1661783555500; Mon, 29 Aug 2022 07:32:35 -0700 (PDT) Received: from C02DW0BEMD6R.bytedance.net ([139.177.225.228]) by smtp.gmail.com with ESMTPSA id x128-20020a626386000000b0052d200c8040sm7259327pfb.211.2022.08.29.07.32.30 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 29 Aug 2022 07:32:35 -0700 (PDT) From: Qi Zheng To: akpm@linux-foundation.org, 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 Subject: [PATCH 6/7] ksm: convert ksm_mm_slot.link to ksm_mm_slot.hash Date: Mon, 29 Aug 2022 22:30:54 +0800 Message-Id: <20220829143055.41201-7-zhengqi.arch@bytedance.com> X-Mailer: git-send-email 2.24.3 (Apple Git-128) In-Reply-To: <20220829143055.41201-1-zhengqi.arch@bytedance.com> References: <20220829143055.41201-1-zhengqi.arch@bytedance.com> MIME-Version: 1.0 ARC-Authentication-Results: i=1; imf22.hostedemail.com; dkim=pass header.d=bytedance-com.20210112.gappssmtp.com header.s=20210112 header.b=zJ+WkTEw; spf=pass (imf22.hostedemail.com: domain of zhengqi.arch@bytedance.com designates 209.85.210.170 as permitted sender) smtp.mailfrom=zhengqi.arch@bytedance.com; dmarc=pass (policy=none) header.from=bytedance.com ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1661783556; a=rsa-sha256; cv=none; b=jDY3hzk10O/QNv4IGRd8zDPtu/hTFztzHbhwc7+Ujmxka74M/th6jFSE5ufJ3M9VS1g8tm /pwcmvtIR17aeyaw5JWTc8tBgP6NBb1Fus4g2J+JUwFx7ZOxPEb2NgRjlB7NoEleQAu2RD XYQd9pzSMvK/n+RpylAD24dxjqDzLj4= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1661783556; h=from:from:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references:dkim-signature; bh=Al2MAS+95n2CdX2+DzZ9586scn02KUFSxAEU+wkQoAw=; b=pYKbuukcH75Ahimj7w3PuZKuZkAPiCu6DLjeMP8X+jnwQlbB5VKD5B++7OWkKvHoeM1ZlK iosCe7V8sZSuSscBuazRujkTG6Sc3BSZxaa+BuO/KQXc2VRywJSavdvZsUliygPm4Zlq8S uH4TpEQksL1mzuOAAi+DZOHYxfgYVw8= X-Rspamd-Queue-Id: 64877C0038 X-Rspam-User: Authentication-Results: imf22.hostedemail.com; dkim=pass header.d=bytedance-com.20210112.gappssmtp.com header.s=20210112 header.b=zJ+WkTEw; spf=pass (imf22.hostedemail.com: domain of zhengqi.arch@bytedance.com designates 209.85.210.170 as permitted sender) smtp.mailfrom=zhengqi.arch@bytedance.com; dmarc=pass (policy=none) header.from=bytedance.com X-Rspamd-Server: rspam02 X-Stat-Signature: yqxc1ypb711rgkgh4pjce69ieq8bksg1 X-HE-Tag: 1661783556-729709 X-Bogosity: Ham, tests=bogofilter, spamicity=0.000000, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: 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 --- 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 {