Received: by 2002:ab2:23c8:0:b0:1f2:fdbc:cb93 with SMTP id a8csp150436lqe; Wed, 27 Mar 2024 01:23:10 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCWaQDzMyDzsBvjw0VtfRSFMCvXGi0lyWZUca1xF1EFvHvG8KePjc7eJ79q/A75/ty1VAmVoC3502IlMgT2NN4n+I8VEub4sJyqAKpEmKA== X-Google-Smtp-Source: AGHT+IE9EAvboD+yXKtq2p1Ud97LD0WG0juRhCAem2wCmYPLjFlj1ZMZIrRhgAAzO58goMAxEezz X-Received: by 2002:a05:6808:1206:b0:3c3:ca85:644d with SMTP id a6-20020a056808120600b003c3ca85644dmr3659181oil.54.1711527790383; Wed, 27 Mar 2024 01:23:10 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1711527790; cv=pass; d=google.com; s=arc-20160816; b=HICA0Dva0Hl4/4QZvp99gnjz6ylpXh+z3QoIwff3Dx090uLAStWwT4jYAMLbeVkfR3 8hL6CaSlarjvWgZdO+IVS9Z2lvMcwYucS0fG0XDO5Fzfl6bBofxT/S8oYEeUylN4Fln5 XxEO5FpP6FVvsdHtNxO+vBEapL49oH/CU04yTLH1GBL6PjKw8PfIvTnQ47Y+8yOJpIsZ nz78dIt4jFpA4uMMiQEpwDhicI3QCxYwOvpoY0ePwChwOhRLTN7rOcQYsQcEfKLe13ca 7t2sKCBLTdFC+8afUni/A9cY0DMowdf1yH0sQY6lL+HKYr54xIfO1yIImoVXBw0xZJ0U bZkA== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=mime-version:list-unsubscribe:list-subscribe:list-id:precedence :user-agent:message-id:date:references:in-reply-to:subject:cc:to :from:dkim-signature; bh=KjMpvpl8BJjl3plUxqf/YcDui9tnfP3PYBzdFnKyUxk=; fh=dxymnU8f0n/tfJpD5r77ceXI5ls0SZSKsg08aYO+6sk=; b=pSrFi8wZJCIMCWgDy2vO0UXpri4Vz2eAMhXuVrTRKHu7o5MJQGdtECSAvwPGqzKkXt 0yGs08D08TRiwjNFzH7KWQPgpzg0FC2kIvMFg+Py4rB/3CM7dl6NmIG1vSwEkxkTOaEn RvREfLP844l+XWlsxFiPEyqaJM4ns3bVLvmsLKSUPT0maXfOyUGBlEIDEUchkUA1PXdz 7PBQLFSL8idW/ge6AP435kife3kkk7B/TINmAz/YCY86pN7utFsc2FtqZsv5pdc7v4kh F8fKOnJSAelYTPfEYunrzIeuDxoO1MWNcXXb1YfM66DDVILQ/Mx3r9hjXeO9ueEA4BkU iNXg==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b=bzECDQ3H; arc=pass (i=1 spf=pass spfdomain=intel.com dkim=pass dkdomain=intel.com dmarc=pass fromdomain=intel.com); spf=pass (google.com: domain of linux-kernel+bounces-120523-linux.lists.archive=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) smtp.mailfrom="linux-kernel+bounces-120523-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=intel.com Return-Path: Received: from sv.mirrors.kernel.org (sv.mirrors.kernel.org. [139.178.88.99]) by mx.google.com with ESMTPS id x6-20020a056a00270600b006ea7bc4e2b2si8796286pfv.383.2024.03.27.01.23.10 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 27 Mar 2024 01:23:10 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-120523-linux.lists.archive=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) client-ip=139.178.88.99; Authentication-Results: mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b=bzECDQ3H; arc=pass (i=1 spf=pass spfdomain=intel.com dkim=pass dkdomain=intel.com dmarc=pass fromdomain=intel.com); spf=pass (google.com: domain of linux-kernel+bounces-120523-linux.lists.archive=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) smtp.mailfrom="linux-kernel+bounces-120523-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=intel.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 sv.mirrors.kernel.org (Postfix) with ESMTPS id 0645F29D9E1 for ; Wed, 27 Mar 2024 08:23:10 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 03CBB2D7B8; Wed, 27 Mar 2024 08:23:05 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=intel.com header.i=@intel.com header.b="bzECDQ3H" Received: from mgamail.intel.com (mgamail.intel.com [198.175.65.15]) (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 80FBD2D608 for ; Wed, 27 Mar 2024 08:23:02 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=198.175.65.15 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1711527784; cv=none; b=LZhhoL63w98oYvr1Coht8ES0PXEhQCP4sfBoTZ8mE8zNs9SVWQQEqkCEEhwyv5XMvDatysi9m3jsfd/FW3mr5SB4VNWTM96cEcdabqnF/cBBP8gBVMc3xIvrfG9WX6X2gCp+djrxlxb9kDbsCyqCrw9xjw6CDhsk3vdoB02J5+0= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1711527784; c=relaxed/simple; bh=0wxrOxqIYdf4MXJwwuzvImG2e/us/u6zEDSUjxq+9KY=; h=From:To:Cc:Subject:In-Reply-To:References:Date:Message-ID: MIME-Version:Content-Type; b=nmSXeWALktGKwVWI77oLZGWYtSGtiNdv16AWPrrJVla0iFEw2cSEktJxs8mrNqFai+czi2h+hy7L/DdtkjJe3chzU7I9Mg5AtmZ2oGL0uua7ffqec9XYxjjIU9YZGqiqdef8EXGTXq5uJRmNkkwXGLjyomnatfhpJmmquhxJ0w4= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=intel.com; spf=pass smtp.mailfrom=intel.com; dkim=pass (2048-bit key) header.d=intel.com header.i=@intel.com header.b=bzECDQ3H; arc=none smtp.client-ip=198.175.65.15 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=intel.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=intel.com DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1711527782; x=1743063782; h=from:to:cc:subject:in-reply-to:references:date: message-id:mime-version; bh=0wxrOxqIYdf4MXJwwuzvImG2e/us/u6zEDSUjxq+9KY=; b=bzECDQ3Hb3Ae4AcrXS4SHoK2b4uZhwrklFXCm46fIZZeFSAOj0bifG5E bWOA9HTL2G7izhPedEZeDQwVL5Mcq2n0Xb8gu5/y4FZ1le9RcqvbZdViU jpYw/WBjLOJ+mExzQngCFXYTEU6sg+giY+fCsUYKsqBhz66qc1HpUU7kA mufQaZaor9Ni6gy2HXZcmbeHiexWsnKjxyRLDByqzAfIYNjUwOI7/Sbe5 gopJmteTjKLxDe+iLWT+maZDhK3lQ8wQHaB/9g3iYI7fxa3wEGMGqOdxN ar6T19RnZ2ZD0CTk7XzAeZSgvcCXKUsGxieDS2R8ilyYbu6gbI0gumTet g==; X-CSE-ConnectionGUID: qOiXfiPsRtGSe4QMvnR/fw== X-CSE-MsgGUID: MuKYe+aeT0Susyg+fMvhUw== X-IronPort-AV: E=McAfee;i="6600,9927,11025"; a="10415497" X-IronPort-AV: E=Sophos;i="6.07,158,1708416000"; d="scan'208";a="10415497" Received: from fmviesa002.fm.intel.com ([10.60.135.142]) by orvoesa107.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 27 Mar 2024 01:23:02 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="6.07,158,1708416000"; d="scan'208";a="39333337" Received: from yhuang6-desk2.sh.intel.com (HELO yhuang6-desk2.ccr.corp.intel.com) ([10.238.208.55]) by fmviesa002-auth.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 27 Mar 2024 01:22:59 -0700 From: "Huang, Ying" To: Baolin Wang Cc: , , , , , <21cnbao@gmail.com>, , , Subject: Re: [PATCH 2/2] mm: support multi-size THP numa balancing In-Reply-To: (Baolin Wang's message of "Wed, 27 Mar 2024 16:09:23 +0800") References: <87cyrgo2ez.fsf@yhuang6-desk2.ccr.corp.intel.com> Date: Wed, 27 Mar 2024 16:21:06 +0800 Message-ID: <87edbwm6fh.fsf@yhuang6-desk2.ccr.corp.intel.com> User-Agent: Gnus/5.13 (Gnus v5.13) Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset=ascii Baolin Wang writes: > On 2024/3/27 10:04, Huang, Ying wrote: >> Baolin Wang writes: >> >>> Now the anonymous page allocation already supports multi-size THP (mTHP), >>> but the numa balancing still prohibits mTHP migration even though it is an >>> exclusive mapping, which is unreasonable. >>> >>> Allow scanning mTHP: >>> Commit 859d4adc3415 ("mm: numa: do not trap faults on shared data section >>> pages") skips shared CoW pages' NUMA page migration to avoid shared data >>> segment migration. In addition, commit 80d47f5de5e3 ("mm: don't try to >>> NUMA-migrate COW pages that have other uses") change to use page_count() >>> to avoid GUP pages migration, that will also skip the mTHP numa scaning. >>> Theoretically, we can use folio_maybe_dma_pinned() to detect the GUP >>> issue, although there is still a GUP race, the issue seems to have been >>> resolved by commit 80d47f5de5e3. Meanwhile, use the folio_likely_mapped_shared() >>> to skip shared CoW pages though this is not a precise sharers count. To >>> check if the folio is shared, ideally we want to make sure every page is >>> mapped to the same process, but doing that seems expensive and using >>> the estimated mapcount seems can work when running autonuma benchmark. >> Because now we can deal with shared mTHP, it appears even possible >> to >> remove folio_likely_mapped_shared() check? > > IMO, the issue solved by commit 859d4adc3415 is about shared CoW > mapping, and I prefer to measure it in another patch:) I mean we can deal with shared mTHP (by multiple threads or multiple processes) with this patch. Right? [snip] -- Best Regards, Huang, Ying