From patchwork Fri Mar 29 06:56:44 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Baolin Wang X-Patchwork-Id: 13610219 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 413A7C6FD1F for ; Fri, 29 Mar 2024 06:57:05 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id A27096B0082; Fri, 29 Mar 2024 02:57:04 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 9D75C6B0083; Fri, 29 Mar 2024 02:57:04 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 89E5B6B0088; Fri, 29 Mar 2024 02:57:04 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0014.hostedemail.com [216.40.44.14]) by kanga.kvack.org (Postfix) with ESMTP id 6DD766B0082 for ; Fri, 29 Mar 2024 02:57:04 -0400 (EDT) Received: from smtpin28.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay05.hostedemail.com (Postfix) with ESMTP id F125841192 for ; Fri, 29 Mar 2024 06:57:03 +0000 (UTC) X-FDA: 81949169526.28.7CE6B26 Received: from out30-110.freemail.mail.aliyun.com (out30-110.freemail.mail.aliyun.com [115.124.30.110]) by imf26.hostedemail.com (Postfix) with ESMTP id 69A87140011 for ; Fri, 29 Mar 2024 06:57:01 +0000 (UTC) Authentication-Results: imf26.hostedemail.com; dkim=pass header.d=linux.alibaba.com header.s=default header.b=tbsA3jXd; spf=pass (imf26.hostedemail.com: domain of baolin.wang@linux.alibaba.com designates 115.124.30.110 as permitted sender) smtp.mailfrom=baolin.wang@linux.alibaba.com; dmarc=pass (policy=none) header.from=linux.alibaba.com ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1711695422; 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:references:dkim-signature; bh=9DmfgnTwR2hgwzNr3ipH242u8MwneYBDqvFX9IPBCmI=; b=MIEwziA/6mT55KVfFuoajy5ubnvjGuou4WA83H5nAHBbTRJbl+IgUHOcKqAe95eA2yYER4 TMCl6Su2LFHcynA1jUERXrPQ6ljN6Grg7wOQ3qKXb2TRNvt0FINNea6vPjGumGAeUWNPSN x08NO2Jf1M/vCTO490jdEWRRqVIr1do= ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1711695422; a=rsa-sha256; cv=none; b=IpXrO7Exo+Spca5GOqymMYpiSf4RzDCh1/QBxAmXE0QGJ+5yUGVjxxqN5M9Az6u2xAQc3S cNU00wwJ9Div8XS8DYqKMdhEQzvSRLIC80k9MBg9j0CwA4Fu1Yjb6Ttnprvg++MSp067jD TZAN8mdg0DOk2brUstTCCIaXWI9fe90= ARC-Authentication-Results: i=1; imf26.hostedemail.com; dkim=pass header.d=linux.alibaba.com header.s=default header.b=tbsA3jXd; spf=pass (imf26.hostedemail.com: domain of baolin.wang@linux.alibaba.com designates 115.124.30.110 as permitted sender) smtp.mailfrom=baolin.wang@linux.alibaba.com; dmarc=pass (policy=none) header.from=linux.alibaba.com DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linux.alibaba.com; s=default; t=1711695418; h=From:To:Subject:Date:Message-Id:MIME-Version; bh=9DmfgnTwR2hgwzNr3ipH242u8MwneYBDqvFX9IPBCmI=; b=tbsA3jXdXlkCnpbz2lqPMWE7/4dGPPGPRe8cJW7VKtHqbDJitSE94AbGHfEDoqPlH3yIKYRD5F/dkZId+N/csUU1WMiW2GgTJLQAtQfUrK5UoYzYukGLeaV0z5zV3Zg+E4ks3uxGC2TL//R0rtavS71ai4VRinmHwFN36FQVIL0= X-Alimail-AntiSpam: AC=PASS;BC=-1|-1;BR=01201311R621e4;CH=green;DM=||false|;DS=||;FP=0|-1|-1|-1|0|-1|-1|-1;HT=ay29a033018045192;MF=baolin.wang@linux.alibaba.com;NM=1;PH=DS;RN=11;SR=0;TI=SMTPD_---0W3Vfrzp_1711695416; Received: from localhost(mailfrom:baolin.wang@linux.alibaba.com fp:SMTPD_---0W3Vfrzp_1711695416) by smtp.aliyun-inc.com; Fri, 29 Mar 2024 14:56:57 +0800 From: Baolin Wang To: akpm@linux-foundation.org Cc: david@redhat.com, mgorman@techsingularity.net, wangkefeng.wang@huawei.com, jhubbard@nvidia.com, ying.huang@intel.com, 21cnbao@gmail.com, ryan.roberts@arm.com, baolin.wang@linux.alibaba.com, linux-mm@kvack.org, linux-kernel@vger.kernel.org Subject: [PATCH v2 0/2] support multi-size THP numa balancing Date: Fri, 29 Mar 2024 14:56:44 +0800 Message-Id: X-Mailer: git-send-email 2.39.3 MIME-Version: 1.0 X-Rspamd-Queue-Id: 69A87140011 X-Rspam-User: X-Stat-Signature: s6nb3ob7wiqedm1mpz4f78njs43ssr1r X-Rspamd-Server: rspam03 X-HE-Tag: 1711695421-834841 X-HE-Meta: U2FsdGVkX1+CxfclNnTXWA+yzRfDZBK/1KpZOUDlbHn29j4ZEkrCJyGK5NG9HyccD5b3Ie1+ZPMwXksV7agjsNGYS5UUvC26WQKUcsuN08owZMp5LGdfnrVXl2XVxQhuM/fErTB76ixBJ1QTld9eHGANp5n2pyd5m7ALZTAv14FQ3JGJBTz5unCSKjaFUNYZ99srJ/uq1OSEnSohwyac0xhlEnXaIREFGmKvKNMB++hisOykGJMr/Q522H90RMRIrM8QEsJ9ZJoxtf5V7BgRD7w1RtXYQZUUFNjPAMWsKeX3/NWBKVDQEDJsvzu/K9KAK1sUK804UDjtg0XM/4AQenYmJTcY8JVpbLsF57W/7WkxuEsBUBpiZDutH+YBv06/d5Q/nKAs+LL8TMKCJUxMptLplvCb8XfClgDpeTD5xcCrEtGGDdTOoGjgtOGMsayzcknK84arFZc3+IYA7txr8xbNZ6FhPzy9BWPvmpFI3Hba+mQUz3gUoJe+CIyRc6/jngSdOe9nMWHIgKdwyptca83Dd/gm3rtzu8dyWC8juWkOkTuw4W+r2FZSMlWscLeGTR5yPeBuASbliQnN9RkXITaPjswgGHd3nEWmoEHAmZvSg/EY0OwpngY4poBSZO8h3U8YilBdBiBXf/0cJ5FvX2Aoilc05stIxvCVFtcye+YyzLO5sfyZ0+Hci8X6vou0IL09a9Prffny+oTOkWNi2Fur+BQ+uR5qGuYwnLPw7xWZo0oGcJNvX8SG37hPiKmSe0lk/Dyckqra/QalOF32aVb8+ONqGjRP+IqkSNtCdy9gDafhsfENV/X2wbgH5BJgoBPZzCL8yQ3jFkm7voVcf0pW1WrXjLom1YYQXgNsKQ8vleqMzp/OSp38UlvKsxuqM+ytDJuwz2TNFINFFbSOKfXthZxpPcoR 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: List-Subscribe: List-Unsubscribe: This patchset tries to support mTHP numa balancing, as a simple solution to start, the NUMA balancing algorithm for mTHP will follow the THP strategy as the basic support. Please find details in each patch. Changes from v1: - Fix the issue where the end address might exceed the range of the folio size, suggested by Huang, Ying. - Simplify the folio validation. - Add pte_modify() before checking pte writable. - Update the performance data. Changes from RFC v2: - Follow the THP algorithm per Huang, Ying. Changes from RFC v1: - Add some preformance data per Huang, Ying. - Allow mTHP scanning per David Hildenbrand. - Avoid sharing mapping for numa balancing to avoid false sharing. - Add more commit message. Baolin Wang (2): mm: factor out the numa mapping rebuilding into a new helper mm: support multi-size THP numa balancing mm/memory.c | 77 +++++++++++++++++++++++++++++++++++++++++---------- mm/mprotect.c | 3 +- 2 files changed, 65 insertions(+), 15 deletions(-)