Received: by 2002:a05:6358:45e:b0:b5:b6eb:e1f9 with SMTP id 30csp3221370rwe; Mon, 29 Aug 2022 07:52:20 -0700 (PDT) X-Google-Smtp-Source: AA6agR72L7k+LiFvtXO3SJes6zE/9c/WMvK/YXmEq106tQHx6Jv+MbqzdpkmKcHfbfCDJeCkLKcz X-Received: by 2002:aa7:c155:0:b0:447:c272:2af6 with SMTP id r21-20020aa7c155000000b00447c2722af6mr15147073edp.308.1661784739826; Mon, 29 Aug 2022 07:52:19 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1661784739; cv=none; d=google.com; s=arc-20160816; b=dvvIek5EKKYWJ3z1psRYE8t23S710yDZ3ZXR4etNIfRDVvJ/Cg/74Z76XMkGPUBqNB avA7t+R2ShsM6aQFjV+z0NCOf3rfn66dJmGZP8qZp0lqWSnkXzgnKq1lv+anXkz5B30D zr2J7awN3biLi5KD2DsUIcJOEqj92l/RmrgINLuWT94G/Jf4gI56C+hQEyxax/X4V9Sq KiU1sKYWAMpIPYOrlI1zakdrx4K7AC+GR0WWyF1opy8nRMO/pVMd+S/WpzlpTCd6bNza lW0fmKPPMiFQjAh/Yt/9uI/lRNSDtQtpE5AjWPX4FLAm3k0uG+FdJ+dp0x697PvE9ULT O2fQ== 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 :message-id:date:subject:cc:to:from:dkim-signature; bh=VxHvmbc/lBdRfA4ap1J+aJWHAOnddONgv856K5nzXe4=; b=fpeH1fXE+2HlljSqEN2bk5MKbjnmrSseWakbpjaMqyZ863cJxlrL9kqqlH5j7Gjts4 dQzaekkVl5nmKqu6uzCOP/dZgip6c8nWFaLGIQCG/6t0mUEnaKgoGAEP316635FUsCnV ph06n3IEqd3YmmOIBPf5fylHtk8sLBLHESq30gxa94MYwkuQiqPm6AvAfYpVC4WuuXXZ +sPfjm0gjO81ivAm+o16WgefLTVhZijTdkXQp2Y5PLooU+C/7F/NA4ncg/6pjg4itMi5 Io0g5rFNeCc8XsI3AgnJ2w20RvyYYkPiAJLMia5kmhD1zCAonnz8uL1ht/4Go0ENhcO5 lH9g== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@bytedance-com.20210112.gappssmtp.com header.s=20210112 header.b=SDTwVfFb; 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 be24-20020a0564021a3800b00445f2dfacaasi6056007edb.614.2022.08.29.07.51.54; Mon, 29 Aug 2022 07:52:19 -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=SDTwVfFb; 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 S229827AbiH2OcM (ORCPT + 99 others); Mon, 29 Aug 2022 10:32:12 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:59028 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229828AbiH2OcH (ORCPT ); Mon, 29 Aug 2022 10:32:07 -0400 Received: from mail-pj1-x102e.google.com (mail-pj1-x102e.google.com [IPv6:2607:f8b0:4864:20::102e]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 13E4A9018D for ; Mon, 29 Aug 2022 07:32:07 -0700 (PDT) Received: by mail-pj1-x102e.google.com with SMTP id i5-20020a17090a2a0500b001fd8708ffdfso5655874pjd.2 for ; Mon, 29 Aug 2022 07:32:07 -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:message-id:date:subject:cc :to:from:from:to:cc; bh=VxHvmbc/lBdRfA4ap1J+aJWHAOnddONgv856K5nzXe4=; b=SDTwVfFbyXwNSrRpny1mr9l89IK5bk6lTYXbTHbnX4AqrYfJExtEOYNP4DSZ+HpeeW aMDvxAGFqzQudjkelHF4dJ4ohqDxLZPrmo4x6xstMJOJEe1lUR/0IvhKfuZ9pkCEtqGi YpmmP41eqBmgMh/jnsypoXJ4e7N00sgVFNJ8vNORqJw3dJFpU+Ys8gI4Zulp0V/fhcdw MtGbX9seBRzHHPF8FJt2U9CSIru1y+8oxNpa6fxcBaTYm/J7dX5s1cczjANcpPzYN/BX 24BjJPqI2o1al501/6O4p0rVbxYPuR3Mmbf0yn9SIAbtMkaaYoX3xkiA1g5q1wbYuVYF RRZA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:x-gm-message-state:from:to:cc; bh=VxHvmbc/lBdRfA4ap1J+aJWHAOnddONgv856K5nzXe4=; b=oCNtaeDSeEojooAauuEdqrglDLLW44xYMmQy4LxSGW99OMfY7PDYYMEmO1ABWoZO55 HNRKeOsn+bP8UkBXRuClvZ2pPRHXL3kt/C42Mhg4ccwztoggQNDDOfvt9BMLfTXG0awI ANyynl9vpcPQSSYtE35UBxwmI74P68FxpFf81bIZqKYfHAfQnPSua85TPQ9x/u6+JLQ6 pi/BzmApIA+I7DB/gCrdSJOiIoAHoPyfVRoJcxuisHQLlEI0+6kVgF7LBLS/ZmSwsiQu Y+WupOQAWY8hlaQ9Lmknj23LylZtLYkx1XnrdLLfbtCohLpJPE9CHtP8WgkLz2UGxoNJ KYJw== X-Gm-Message-State: ACgBeo2mnGKNv7wGenrnzzYPBbmZNejRwCNIbZBsZd/sixPw7rzwD+L4 eGYkagLuMfBEdf211IDSaZGyZg== X-Received: by 2002:a17:902:7c0b:b0:174:abfc:f5 with SMTP id x11-20020a1709027c0b00b00174abfc00f5mr6543887pll.124.1661783526523; Mon, 29 Aug 2022 07:32:06 -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.02 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 29 Aug 2022 07:32:05 -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 0/7] add common struct mm_slot and use it in THP and KSM Date: Mon, 29 Aug 2022 22:30:48 +0800 Message-Id: <20220829143055.41201-1-zhengqi.arch@bytedance.com> X-Mailer: git-send-email 2.24.3 (Apple Git-128) 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 Hi all, At present, both THP and KSM module have similar structures mm_slot for organizing and recording the information required for scanning mm, and each defines the following exactly the same operation functions: - alloc_mm_slot - free_mm_slot - get_mm_slot - insert_to_mm_slots_hash In order to de-duplicate these codes, this patchset introduces a common struct mm_slot, and lets THP and KSM to use it. This series is based on next-20220829. Comments and suggestions are welcome. Thanks, Qi. Qi Zheng (7): mm: introduce common struct mm_slot mm: thp: convert to use common struct mm_slot ksm: remove redundant declarations in ksm.h ksm: add the ksm prefix to the names of the ksm private structures ksm: convert ksm_mm_slot.mm_list to ksm_mm_slot.mm_node ksm: convert ksm_mm_slot.link to ksm_mm_slot.hash ksm: convert to use common struct mm_slot Documentation/mm/ksm.rst | 2 +- include/linux/ksm.h | 3 - mm/khugepaged.c | 121 ++++++--------- mm/ksm.c | 326 ++++++++++++++++++--------------------- mm/mm_slot.h | 55 +++++++ 5 files changed, 260 insertions(+), 247 deletions(-) create mode 100644 mm/mm_slot.h -- 2.20.1