Received: by 2002:a05:6358:45e:b0:b5:b6eb:e1f9 with SMTP id 30csp3221374rwe; Mon, 29 Aug 2022 07:52:20 -0700 (PDT) X-Google-Smtp-Source: AA6agR5v0JcdqrWV9bFcJVydXICj5hQN/qqkybJ8zImX3X2Yygvd7lllZUvPjentnYIbteZeuC5w X-Received: by 2002:aa7:cb56:0:b0:447:8d82:729b with SMTP id w22-20020aa7cb56000000b004478d82729bmr17208892edt.342.1661784740069; Mon, 29 Aug 2022 07:52:20 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1661784740; cv=none; d=google.com; s=arc-20160816; b=yQOjI2QCj2rg3s0h6xg+5AwbBEXoC1S+3fQzVnRb+vk+19swm4csjZ/460GsmTCcSF hbBsbX5Ow7eLXTfyio86kmTVHOfq8UKjBBOMwtplHZeLyNP6KoHyAI9i5B1hQhjNO4Vh F1pkFMUW1hQETpISml2OohdTDOuKIFc0Aw+9VpSyYzgGv1RJVQRoz3N8x36XuKX1HiX8 IObLD7DqS+WioeeZWQCVExdv5grdiSPl7I0jSplpXFkJHa6ML8qIREg8zLBcH3lj6zR7 XrMISIGck8N3K8KmUkzx5o2MIlekvk8VOMSe5c/qalnd/dWMFVxHbi5YgTjuFI8yXriR JXxQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=Al2MAS+95n2CdX2+DzZ9586scn02KUFSxAEU+wkQoAw=; b=aMFuK6UBaeWLVHGeD83R3k6mIytticfLFy5AFlniKE6rOdxJ3XLhEwacihpP7Y09bI jdzX1oOx7P2bm9CQr9q7UmLFqGdST1uttYk2TJ4NKrPLlP3pgEq3he/7mQd3QL3iEAMu xO9LUZfbHD9D3HLGmsP3Qxg+znzHiadrDkzHcNTxAdEPPR41XZIBQIM4iXC7d5vrSlRp WltpSvVO/T4AlqnjpmCdJSoRdo6fkWvqy+AYx8tHZcgkvNGQ+lWzKl7seWVCnAzoZByO BjB8Tn4hrT0iUZlCH7t5ry1feXuiWO5RH4xkpATGEGVbcEPC6bgl8UC5ESQVdIXH23eB k1HQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@bytedance-com.20210112.gappssmtp.com header.s=20210112 header.b=zJ+WkTEw; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=bytedance.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id u8-20020a170906780800b0073083c63edcsi6011068ejm.306.2022.08.29.07.51.54; Mon, 29 Aug 2022 07:52:20 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@bytedance-com.20210112.gappssmtp.com header.s=20210112 header.b=zJ+WkTEw; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=bytedance.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230201AbiH2Oc5 (ORCPT + 99 others); Mon, 29 Aug 2022 10:32:57 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:59976 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230140AbiH2Ocm (ORCPT ); Mon, 29 Aug 2022 10:32:42 -0400 Received: from mail-pf1-x436.google.com (mail-pf1-x436.google.com [IPv6:2607:f8b0:4864:20::436]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 9929593238 for ; Mon, 29 Aug 2022 07:32:36 -0700 (PDT) Received: by mail-pf1-x436.google.com with SMTP id 145so7996637pfw.4 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=OGndhH1poT7Xua0Z426YNiweekfLse7bxGxDJZr0Ju7ls1YCbZKE7+ZV6NpgxdvB55 G+sWV9UDhxcF2rhNgMvBjkNLAuHHYAnS/b0d5u3k1O44/Fv+Kr4gEiAnGLlJ9XB9RFbY +JiGKwqmapSYxMtFJBrT6SyB0fJF2e4hxPC/7xCd88HLJF9QxK9pHEcPo5u4WhYD5ETL JqDMQ+FrTaDfN7ey1vqOmtLMkaSnepWxWLRYWeax8muAbNQLFYsHucGOLMVxFWkDDBMG ajguhvwYj6znSKqZwj/Lt3Ml/17OsUE/3jY2WSeTqZgKEp8CpAzL7j2U1YzLTeQt48jg +z4Q== X-Gm-Message-State: ACgBeo37REDZoYqvGniRX1ipEluKB4r38Rpvrhl079+jvkS9md/MblUN bMoQiGIqAv3JZ9qicDfcQLheiw== 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 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,RCVD_IN_DNSWL_NONE,SPF_HELO_NONE,SPF_PASS, T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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 { -- 2.20.1