Received: by 2002:ab2:1149:0:b0:1f3:1f8c:d0c6 with SMTP id z9csp2565775lqz; Wed, 3 Apr 2024 01:40:06 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCXbSJ5erRHUniZ6/+dvvdhKfsWQHEo4ynVWanfHqSykYJO8HnTlZa10pBASgnfKXPWFsaXsYxqy1le9eJSSroa996a23GYs9+tiOZLcwg== X-Google-Smtp-Source: AGHT+IEXHIh6lvrzdXv+kisOwzXLGlg5hr0iox8UAKbYshcUXtVmryXR5fUI7PJfahnjSBowb1Dl X-Received: by 2002:a17:906:3658:b0:a4e:4f58:c2bc with SMTP id r24-20020a170906365800b00a4e4f58c2bcmr1505793ejb.14.1712133606405; Wed, 03 Apr 2024 01:40:06 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1712133606; cv=pass; d=google.com; s=arc-20160816; b=oj7KbydDngymL686bN+z/aDkrb+vUdR7NahO16MVA7C5RGKICHVlWjmCMC2+W70BWb AHXz9E9dlodguLKALUzLgshKhv+XNJ/MrbXwmXznnXiQN9QFPm6y64AgZ09EEEclwbdZ hNBszsUBtVZBinUV8mesT8m3BjCTxiZGJIHuiIiFJW+xboKbFqe/67Up1HVkoUsPE6Yk CAsYxapZo8oYVIzvoSoMJFfBqA4L70JnmL1dwRV/XVxhJ/R46Tp8KXIJjw3Mp5pNgNc1 DLSYn8TEOPDp9VAQ8o29BjwC49iFOEGZl8dapCES89bXAmF0MOybzPvIs13goky8NIQm kQng== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:message-id:date:subject:cc:to :from:dkim-signature; bh=vye0y79PlRt04GkvkiqfdvGYaxiubkuCi3SqjHc32s4=; fh=cX6fevSCX4GwlyFKhduzR2rC/JxBw/iyi+zuCYLj1Jk=; b=cY9+TTR5Xl81bSJQ4WE7n5ESk/UU50nWIHgZTc+cK3KX0HFHVEwRcamsVjQYV1sHuN o4x2SYnKtM4kklhXyrlZTSLRmPNQgU6+MkTJcxg1DMy0vewIHBtBqioYNke3Ravx8JMy 71z2vaHvlq5tooQEVdPHHR6PNQvWuIjZSxcC9Ofc3wds/uojG6AWhoYoKpOLE4FYARNU 4fyeRu8unSP/s1qtX5a6sChht/L8CAFn/r1cvyVoMdP93Drk3Vug+aotkqDvQi3fBKuY 8v/GN97oxsnbVKpU8ue6ttNRSJ4Tmxbr/YwljK7mZcuW61Y4ShJImo5vYsSprABa9AB+ YHLg==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@linux.alibaba.com header.s=default header.b=dwX1D1Aw; arc=pass (i=1 spf=pass spfdomain=linux.alibaba.com dkim=pass dkdomain=linux.alibaba.com dmarc=pass fromdomain=linux.alibaba.com); spf=pass (google.com: domain of linux-kernel+bounces-129349-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) smtp.mailfrom="linux-kernel+bounces-129349-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linux.alibaba.com Return-Path: Received: from am.mirrors.kernel.org (am.mirrors.kernel.org. [2604:1380:4601:e00::3]) by mx.google.com with ESMTPS id p3-20020a170906604300b00a46328866d0si6468712ejj.508.2024.04.03.01.40.06 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 03 Apr 2024 01:40:06 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-129349-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) client-ip=2604:1380:4601:e00::3; Authentication-Results: mx.google.com; dkim=pass header.i=@linux.alibaba.com header.s=default header.b=dwX1D1Aw; arc=pass (i=1 spf=pass spfdomain=linux.alibaba.com dkim=pass dkdomain=linux.alibaba.com dmarc=pass fromdomain=linux.alibaba.com); spf=pass (google.com: domain of linux-kernel+bounces-129349-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) smtp.mailfrom="linux-kernel+bounces-129349-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linux.alibaba.com Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by am.mirrors.kernel.org (Postfix) with ESMTPS id 1FCD21F24DD5 for ; Wed, 3 Apr 2024 08:39:32 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 2B72D69302; Wed, 3 Apr 2024 08:39:26 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linux.alibaba.com header.i=@linux.alibaba.com header.b="dwX1D1Aw" Received: from out30-98.freemail.mail.aliyun.com (out30-98.freemail.mail.aliyun.com [115.124.30.98]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 9C97A44C8C for ; Wed, 3 Apr 2024 08:39:22 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=115.124.30.98 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1712133565; cv=none; b=KnJvf2GEMi7U6gH0n5jg0YDM+GgA97bT5yr6gQK4JoHudMpTwOdtpMbBH/yoWYylRgEUPftJaE3byKLF+DLD2hzI5IS/UES9LoXi0YRP+w2Jth2b+jCdfIn1icvVk7K4dHW4No0nUPBIBu2WLRrr7znqwpHpdew1j+6jULwV1FE= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1712133565; c=relaxed/simple; bh=s4zowk5FDHZhrtl6SwdsvDgYGksJJs1ua8krFDh1+cc=; h=From:To:Cc:Subject:Date:Message-Id:MIME-Version; b=MS1VKYHviFg3zad0Nnk8vi8Dd47YVA8TAl08qj3DYnegQaEoiccyoBfg4BqqRlInCtBeDA4qjm7IMP0qFtsOQm/CraXwUo13aJ8OU4g3JKUJ8x4HXgMwHi0krShSfJN3d47AXULStz9kbep74X577Mx7KaLILI83ZP4Sa/dW5AE= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.alibaba.com; spf=pass smtp.mailfrom=linux.alibaba.com; dkim=pass (1024-bit key) header.d=linux.alibaba.com header.i=@linux.alibaba.com header.b=dwX1D1Aw; arc=none smtp.client-ip=115.124.30.98 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.alibaba.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=linux.alibaba.com DKIM-Signature:v=1; a=rsa-sha256; c=relaxed/relaxed; d=linux.alibaba.com; s=default; t=1712133560; h=From:To:Subject:Date:Message-Id:MIME-Version; bh=vye0y79PlRt04GkvkiqfdvGYaxiubkuCi3SqjHc32s4=; b=dwX1D1AwxoYeWXRjD2HJrGzkep2ow8eTo/8sF49sAKSxRkvOUPz9Whv4tbnVVmZwOe7vVRTzAmZd6Gp3YEG5/tIfb72ei2SiJbuLss2Vy2fdz+B+kVnsGYbMnjrRNQcZPnmQH6pF6GT7rh4L5F9gQe3MVqjDVwGnZkgLVBTryNw= X-Alimail-AntiSpam:AC=PASS;BC=-1|-1;BR=01201311R191e4;CH=green;DM=||false|;DS=||;FP=0|-1|-1|-1|0|-1|-1|-1;HT=ay29a033018045168;MF=baolin.wang@linux.alibaba.com;NM=1;PH=DS;RN=11;SR=0;TI=SMTPD_---0W3rA0.M_1712133558; Received: from localhost(mailfrom:baolin.wang@linux.alibaba.com fp:SMTPD_---0W3rA0.M_1712133558) by smtp.aliyun-inc.com; Wed, 03 Apr 2024 16:39:19 +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 v3 0/2] support multi-size THP numa balancing Date: Wed, 3 Apr 2024 16:39:08 +0800 Message-Id: X-Mailer: git-send-email 2.39.3 Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit 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 v2: - Add reviewed tag from Huang, Ying. - Reuse numa_rebuild_single_mapping() to remove duplicate code per Kefeng Wang. - Remove an unnecessary vma_wants_manual_pte_write_upgrad() per Huang, Ying. 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 | 76 +++++++++++++++++++++++++++++++++++++++++---------- mm/mprotect.c | 3 +- 2 files changed, 63 insertions(+), 16 deletions(-) -- 2.39.3