Received: by 2002:a05:6358:45e:b0:b5:b6eb:e1f9 with SMTP id 30csp64712rwe; Tue, 30 Aug 2022 21:11:37 -0700 (PDT) X-Google-Smtp-Source: AA6agR6jXD+wyqOujd3LUNNGRNYjdEpxqCYGjJvYCEx+GJZHn3nWCCnV8Rlshf3Er+n7f2+Or0+B X-Received: by 2002:a17:90b:4c52:b0:1f6:3a26:9f08 with SMTP id np18-20020a17090b4c5200b001f63a269f08mr1348587pjb.206.1661919097715; Tue, 30 Aug 2022 21:11:37 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1661919097; cv=none; d=google.com; s=arc-20160816; b=g11fiN2qJb0rQdcRnzlPmRsadcT3EhWSuaYfKSIBwuLIz3XwXWf3DSmCccCabgZVn2 JjsqlOllsJ9u2kTBWuXq4Uek5O9S09Zd+bHnr73cGt3np58xBfAGyvghjZKzP9iZZAE1 oOPNZstxxf9GslwUuR979QCa6p4KwIGkfNnmxPG3smLbGqYuFDX3UHl2GBusT/5YS/9g LogI/BLVbp6U+k2f41MNFy1626hqKBkipL3K5pfLlVmY/h7mfL6LSi2AG+qnVcD1ernv DeHjmkodOZiIEqWjpUgpvmqY6AJx1gqz18nrBZ+SvHwZiElqGJUN5bU/BhOI5sfnbHQF cd2A== 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=v7Q+HHnOQCPwmVlfrZr6AImldFLltmX8PsInykk2xfI=; b=nUNLGRAkC9rb0d4a07Ldc3+5DOCYm52Qkt+vvdm19QjLG4DNSbVkZgmOgQnhTiiVdh LuX8o+ecoTja1SZuK1o6AjJNK3WDpEqY8IIXqFbVmS6purueYkQpldXFWpv3T5IsZpdT citIMWCxS7OeUpRQDtMQHVI1tCZR6IkegCBp03/MHmGfmKhdcHmYxu8V083PA8sdbPsf qK/GlWIYQlrSbOxAkrFD1CRXJCiAZ3r0x+GYku/UOzkp0OY6kmVwEQDJ0LVHPqe2CPhy +bQsKrv3Rs7eGmHdYV3EbB4vwm+0mxaUnQ77EUGsibntY0eJITCMz8mUcvdiYJY+w8e1 hBNQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@bytedance-com.20210112.gappssmtp.com header.s=20210112 header.b=U65jboiY; 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 oj13-20020a17090b4d8d00b001fdf08df84esi878471pjb.182.2022.08.30.21.11.25; Tue, 30 Aug 2022 21:11:37 -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=U65jboiY; 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 S231654AbiHaDUw (ORCPT + 99 others); Tue, 30 Aug 2022 23:20:52 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:58884 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232262AbiHaDUV (ORCPT ); Tue, 30 Aug 2022 23:20:21 -0400 Received: from mail-pg1-x52f.google.com (mail-pg1-x52f.google.com [IPv6:2607:f8b0:4864:20::52f]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 1616510FED for ; Tue, 30 Aug 2022 20:20:09 -0700 (PDT) Received: by mail-pg1-x52f.google.com with SMTP id 202so12397904pgc.8 for ; Tue, 30 Aug 2022 20:20:09 -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:subject:date; bh=v7Q+HHnOQCPwmVlfrZr6AImldFLltmX8PsInykk2xfI=; b=U65jboiY95Cmqy2YaTAbsIibfhChRdktNV1Du22CPObuhxwOnA8eyc1SxFlUMa5kWG GNMayYyOHqpYZ92tPKgGQnPJJT2yDPjgEmK0MC2U6SJxlA7rvM93Bz4H4JWiYIKwX8DP Hc0AFB3MrtvutmvE3wBnNpxI0V9C7gaL+x/A/bqc+IudJigVLqGOOO/RSwLU89dvdpcr vkxMuMBgHZ+gtCPYWJ75zBPfJV6gW0tjplLBOGQ//toIStK2aWYpTbvOL4/mWdnhCi9n 6zgw/rFvswBkTxEIfRrF5N/tyZjynT91saOsslEnNX+3QTxwFW7mHlHBOA7ICxG4H/JV tdEA== 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:subject:date; bh=v7Q+HHnOQCPwmVlfrZr6AImldFLltmX8PsInykk2xfI=; b=0TpHolHrmxquDhhPT2SlM0JTFtXdM0VgmEhxCVYw/EXcvyCBk/C6hqGcWIcRASmxC/ ePhVwnHbcxKIOGmCy5QmhHXIh6cAFW2hCy2D4xjdZ0rlUXJHQUItHjf0eqDTu3o8w53o oTy7VJynpwy9iFkfdTPpjcnOKbpE/Fa2mlbxHwZmon8xreafaXir/BSe/Pk1HDWC5Qjb TTPO9KA9bqwzFnSwegci4eWvI6gVVKBp47KLDxuqM2eEcu+zYOZQ272kAHMMIEflXu9P RKmETDBICPWoLPYgCaUGizu1/5kSzVq0Kzd5qagWFbKgrhIDqgbmNDc3PXQvWiSfVgmW sIXg== X-Gm-Message-State: ACgBeo0g6z/L01M89hD4QJeEUqYwzh80/3Rb7n/vpVinQgQ0BV5vULAD /VN/GlRjLF839CvWbwLySVYEJYnYkIl8AQ== X-Received: by 2002:aa7:8393:0:b0:537:701d:e7f3 with SMTP id u19-20020aa78393000000b00537701de7f3mr24416745pfm.50.1661916008151; Tue, 30 Aug 2022 20:20:08 -0700 (PDT) Received: from C02DW0BEMD6R.bytedance.net ([139.177.225.245]) by smtp.gmail.com with ESMTPSA id i13-20020a170902c94d00b0015e8d4eb1d5sm8633535pla.31.2022.08.30.20.20.03 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 30 Aug 2022 20:20:07 -0700 (PDT) From: Qi Zheng 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 Subject: [PATCH v2 0/7] add common struct mm_slot and use it in THP and KSM Date: Wed, 31 Aug 2022 11:19:44 +0800 Message-Id: <20220831031951.43152-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. Changelog in v1 -> v2: - change the names of these mm_slot related operation functions (suggested by Andrew) 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