From mboxrd@z Thu Jan 1 00:00:00 1970 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 0690EC4332F for ; Mon, 13 Nov 2023 12:59:36 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 694906B0198; Mon, 13 Nov 2023 07:59:36 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id 642F86B019D; Mon, 13 Nov 2023 07:59:36 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 559536B01A3; Mon, 13 Nov 2023 07:59:36 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0011.hostedemail.com [216.40.44.11]) by kanga.kvack.org (Postfix) with ESMTP id 4918C6B0198 for ; Mon, 13 Nov 2023 07:59:36 -0500 (EST) Received: from smtpin26.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay10.hostedemail.com (Postfix) with ESMTP id 17CA3C07C1 for ; Mon, 13 Nov 2023 12:59:36 +0000 (UTC) X-FDA: 81452937552.26.D384697 Received: from out30-112.freemail.mail.aliyun.com (out30-112.freemail.mail.aliyun.com [115.124.30.112]) by imf19.hostedemail.com (Postfix) with ESMTP id 8DBDD1A0021 for ; Mon, 13 Nov 2023 12:59:32 +0000 (UTC) Authentication-Results: imf19.hostedemail.com; dkim=none; dmarc=pass (policy=none) header.from=alibaba.com; spf=pass (imf19.hostedemail.com: domain of baolin.wang@linux.alibaba.com designates 115.124.30.112 as permitted sender) smtp.mailfrom=baolin.wang@linux.alibaba.com ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1699880374; 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-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=fmtNmFWlk8JaUGu6GyljDYC0Bk48sovI7GYr2iN4AaQ=; b=j37qXW/htacFPY35Qj3migu0lboPueI9ev5vTP1gxUx6AR48H7cg5MxWB42FZx7GVIco0e gaEhlABPpH8LEazrb8m+bdrBhDAfPHbfweyXvesPhEDMh5o3nhYEWxKUuQJJYWJtwAvPu8 1PWbYlAxHzh+fFkUZSvtiflLLhy5PTA= ARC-Authentication-Results: i=1; imf19.hostedemail.com; dkim=none; dmarc=pass (policy=none) header.from=alibaba.com; spf=pass (imf19.hostedemail.com: domain of baolin.wang@linux.alibaba.com designates 115.124.30.112 as permitted sender) smtp.mailfrom=baolin.wang@linux.alibaba.com ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1699880374; a=rsa-sha256; cv=none; b=RdJ/8eST8c5LgSqo45+s8NLd4niWc+ghddpHXTpiEvilNPL4n5LzBf1ir0yngMkhVaBRFe 6ZUWQhZVA55jyjnKHVgBwflJKlL7HvMxo5QdZPmTBEe7HBV1KwpzeBTMWUKBNzKb9ke5AH Gd6GSNqAmPUrswGc1Efd3VXNzczkSEc= X-Alimail-AntiSpam:AC=PASS;BC=-1|-1;BR=01201311R111e4;CH=green;DM=||false|;DS=||;FP=0|-1|-1|-1|0|-1|-1|-1;HT=ay29a033018046056;MF=baolin.wang@linux.alibaba.com;NM=1;PH=DS;RN=8;SR=0;TI=SMTPD_---0VwL8Mwl_1699880365; Received: from 30.97.48.50(mailfrom:baolin.wang@linux.alibaba.com fp:SMTPD_---0VwL8Mwl_1699880365) by smtp.aliyun-inc.com; Mon, 13 Nov 2023 20:59:26 +0800 Message-ID: <517f2a75-638d-4f17-a5c1-719e15507c6a@linux.alibaba.com> Date: Mon, 13 Nov 2023 20:59:37 +0800 MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: Re: [RFC PATCH] mm: support large folio numa balancing To: David Hildenbrand , akpm@linux-foundation.org Cc: ying.huang@intel.com, wangkefeng.wang@huawei.com, willy@infradead.org, linux-mm@kvack.org, linux-kernel@vger.kernel.org, John Hubbard References: <606d2d7a-d937-4ffe-a6f2-dfe3ae5a0c91@redhat.com> From: Baolin Wang In-Reply-To: <606d2d7a-d937-4ffe-a6f2-dfe3ae5a0c91@redhat.com> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 8bit X-Rspam-User: X-Rspamd-Server: rspam12 X-Rspamd-Queue-Id: 8DBDD1A0021 X-Stat-Signature: r9iqg63ezw7ujskqkz3coj4cbcmijtx9 X-HE-Tag: 1699880372-773075 X-HE-Meta: U2FsdGVkX19VKzmRRRs9CL2iT/MC3jxCtd3KYRKXpjFVw8PwcS4RhJulshdd6fWNSlnOSye/sL1pq/nEMMeehwCviVyistDnOmFf+yQpHQ2a0T53RIa2l1GzClM5XU7HRPxdY1kAqpgkwUytj53HtHnAiuwDbRtyEYUvSgjPX8jcJPGO6Y4NjgEQ7wtgr0ZBnq+EJT99/NptfegXCu1OnCOAOzEps6SpoM40UGD1+3wnMo2xYJbMIWB4bge/kSCUnkHzptQILjauSu9Jthn2DUChQDHrp1hxrrSn2D7BNTlc7sFvOSST61QkxCfu74VGtDUj7tduHtp9kjGIBtRhqtXJIYTetpnznF+eGHAam+6lUPWRfZxBI8S/W9Os4flGsIG0U9z2fVhQMccdDHD0cQMm1jVcyzJBDaWIyMhmfZfhRvgwtZsY9Vm5xmixkBP7pPCFvzvNAfWrZh8pg7mOzy+1hlrapg0Uns02oxExsoSQ+XJHjlI74kqAGY8I9t5Tpb7HAaMe8GEOfYjIz5s0YVb1vqoismMhQf9jdVPrGA3rwV9+3/CdEsE+BElJypf/h6yZdHAD+BXYoVNIm4ftunSG/M7cqJxODOEE4D07UFhFEh8kylnLi/oV0adaaS+/sYXWAmbizyeLPwc/tsxxx/TI36hOf7B9OkAnp4BgK6ZKrabjiMcgKk0kfnc+s7ZFoPXP9Iw6TTw8nMCbeoBpRqMgpQ7VMgKz6e8PghCgjh63hOAN7DAS6QMzy4sDa/zasB0lp8lzlqUPXFJ43C7mGgeWowakxWq1yC0qsZN/zKhfTYPyZ3fcYDDz6Q2WJt76CqEAhP9wjUYOzoJSER2Y5JAXqxpIaovxvRROwvOb+F0jwV0023sSLrQ/0MEyuOV3KipQYSTI4EG2cEDUEZeHGZRnHntyzpqn71BcINXPlmrx/Z8ncTOWMbmzUfNZpXasM2FckdTdGH4iv5K1SUi PQhQ3cEJ iLujYVow9uO1TWE4DpOx2lPs3c1ysVHHcSFL2yk4V7i1gOX2WJ8Wl8JWUSPL3zd2GIFXT4tHe7zI0bUbZI4mUK0/ZK/ei8BBI9L/EqFOCXXKJqNLrocHD1MJmFK6B7DyTMjKp 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: On 11/13/2023 6:53 PM, David Hildenbrand wrote: > On 13.11.23 11:45, Baolin Wang wrote: >> Currently, the file pages already support large folio, and supporting for >> anonymous pages is also under discussion[1]. Moreover, the numa balancing >> code are converted to use a folio by previous thread[2], and the >> migrate_pages >> function also already supports the large folio migration. >> >> So now I did not see any reason to continue restricting NUMA balancing >> for >> large folio. > > I recall John wanted to look into that. CCing him. > > I'll note that the "head page mapcount" heuristic to detect sharers will > now strike on the PTE path and make us believe that a large folios is > exclusive, although it isn't. > > As spelled out in the commit you are referencing: > > commit 6695cf68b15c215d33b8add64c33e01e3cbe236c > Author: Kefeng Wang > Date:   Thu Sep 21 15:44:14 2023 +0800 > >     mm: memory: use a folio in do_numa_page() >     Numa balancing only try to migrate non-compound page in > do_numa_page(), >     use a folio in it to save several compound_head calls, note we use >     folio_estimated_sharers(), it is enough to check the folio sharers > since >     only normal page is handled, if large folio numa balancing is > supported, a >     precise folio sharers check would be used, no functional change > intended. Thanks for pointing out the part I missed. I saw the migrate_pages() syscall is also using folio_estimated_sharers() to check if the folio is shared, and I wonder it will bring about any significant issues? > I'll send WIP patches for one approach that can improve the situation > soonish. Great. Look forward to seeing this:)