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 0B287C71145 for ; Thu, 24 Aug 2023 06:26:32 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 94BB9280086; Thu, 24 Aug 2023 02:26:31 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 8FC088E0011; Thu, 24 Aug 2023 02:26:31 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 7C334280086; Thu, 24 Aug 2023 02:26:31 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0010.hostedemail.com [216.40.44.10]) by kanga.kvack.org (Postfix) with ESMTP id 68B688E0011 for ; Thu, 24 Aug 2023 02:26:31 -0400 (EDT) Received: from smtpin25.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay05.hostedemail.com (Postfix) with ESMTP id 2BA5E401F7 for ; Thu, 24 Aug 2023 06:26:31 +0000 (UTC) X-FDA: 81158014182.25.76852C9 Received: from out30-98.freemail.mail.aliyun.com (out30-98.freemail.mail.aliyun.com [115.124.30.98]) by imf03.hostedemail.com (Postfix) with ESMTP id 32CD520005 for ; Thu, 24 Aug 2023 06:26:27 +0000 (UTC) Authentication-Results: imf03.hostedemail.com; dkim=none; spf=pass (imf03.hostedemail.com: domain of baolin.wang@linux.alibaba.com designates 115.124.30.98 as permitted sender) smtp.mailfrom=baolin.wang@linux.alibaba.com; dmarc=pass (policy=none) header.from=alibaba.com ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1692858389; 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=/Y5n6WpIDW7XVY1SKYBxMmKQ2VLbBKlxehduuWbgA4E=; b=MXqYM0cdIorxcccIoCbe13lLShlAUabFAnsWn42EvFc6KUjvpWH9jQrKj9gXYzK+YETlnk +58oYBYbMHX721ieRtJI+0kAf837JebBHFDhDEhwGGC92FevVaiaCFgXo2ymVGnQ1M4jjy gRBwyaBR+2L0l8JTOy40nwqqERNbjCE= ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1692858389; a=rsa-sha256; cv=none; b=eCw8A/JI1s+HNzwe/csJ4i3EVM2IoqwouKmovQWEqsuvnTCl1rspMyT2gj0V5QO5hfphad kGd1BQX6feDks4GwbKbq2PikKjivjjVtjWqVVyQKj2Rm05OobW+Ssps0ir+MYt6x3dY63l al5vEyPNTOwm/GLnY3VFjN9J4gFng3s= ARC-Authentication-Results: i=1; imf03.hostedemail.com; dkim=none; spf=pass (imf03.hostedemail.com: domain of baolin.wang@linux.alibaba.com designates 115.124.30.98 as permitted sender) smtp.mailfrom=baolin.wang@linux.alibaba.com; dmarc=pass (policy=none) header.from=alibaba.com X-Alimail-AntiSpam:AC=PASS;BC=-1|-1;BR=01201311R411e4;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=7;SR=0;TI=SMTPD_---0VqSeeXB_1692858383; Received: from 30.97.48.68(mailfrom:baolin.wang@linux.alibaba.com fp:SMTPD_---0VqSeeXB_1692858383) by smtp.aliyun-inc.com; Thu, 24 Aug 2023 14:26:24 +0800 Message-ID: Date: Thu, 24 Aug 2023 14:26:25 +0800 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:102.0) Gecko/20100101 Thunderbird/102.14.0 Subject: Re: [PATCH v2 0/4] Extend migrate_misplaced_page() to support batch migration To: "Huang, Ying" Cc: akpm@linux-foundation.org, mgorman@techsingularity.net, shy828301@gmail.com, david@redhat.com, linux-mm@kvack.org, linux-kernel@vger.kernel.org References: <87pm3fbxos.fsf@yhuang6-desk2.ccr.corp.intel.com> <87zg2h9h5c.fsf@yhuang6-desk2.ccr.corp.intel.com> From: Baolin Wang In-Reply-To: <87zg2h9h5c.fsf@yhuang6-desk2.ccr.corp.intel.com> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit X-Rspamd-Queue-Id: 32CD520005 X-Rspam-User: X-Stat-Signature: btp8gonr4u88hhdqkffqd5i59x4p9etw X-Rspamd-Server: rspam03 X-HE-Tag: 1692858387-172136 X-HE-Meta: U2FsdGVkX1/rlKbK46geovMtHHALeSvugE40osjBal80vf5fIoPltcmpS9/Q70FymRnwMA+XPR0sn0jy22XRUBSoNuVEEEUPIxHAywUNzBF9C2DP03wzEeLmYD22DrjyMePAMuIIGWmRXHd87grqjOD7zWitQEzrpqmW53BVYxUR8jvqBGn0jWTNPm8suNgG03X22Wsdyowb1qvQFpZ/ADkrujkS0gvis328GfbJRSgl0jgAfgIAIHYpahfYbtkJgvc5ImIi0cHrfYTS9SDNTOdS9XahQcyOnjl0z1CIK5bmbV7Mk3OCdnatKx05xeqX8J0YGQiJdmbSrIvyyj1/GYzZbXiz+khSV3M6gBQkZx5FZJuKrx703upR/j7k7PZFO9IToMKFBsNJjseiCxEsok9C6mY8i8sS7C7YHX2Y15Y0eZfQ+jMNLEwulWCjONtF/LakVWWzuOs1Y3OZmskHsqDSNm7rh0tChkClwc2nqvIYy40MXGFjf/Bp4IWPBQAnzUUF3f5Pn1CoavR5t0rRckDdlDevvJ7P7OFfURZUv5bI2T/qIro6QB3bcho0tJwqLNztap1Y9YJYDlI+pv1OfVXbb/4rRYvmXG9tv6gLCX0HmK+UjGgz6DyJTSf90ckax1gMGG1jMD8kA+O71JfL2Qrl+xy5Xs3NUHYSCWYTKcKxSDRVOxIgdTnEXrN/UlyLFJcwrZjzFJ+6JxOJwttLwVMXLj0yyRr8TwgPU/owIN60bj14k4D+K0Lxn9Sv2pQ6b4Oo+ohzQ1glgv/ahVHXoan+UuEre7mg6nUpQyIsHuxXbX5zUgu/aYKKxjp9PkcV9++s4vo1HDUPBY8586AZCmHOGSEnkPFkrljEyLz9/AhM44Ikc38EdJ4SVPNfWWo3TyuBqdRSfZjw+GGnuNgT1dO7KybSx7BHEHUvz8r8U2QMJr0Rmlwo0r5DksIcaZt+RZupBE3HWOW9eFjsX1d cxl+GPUK AYj9LmHy2UKyeCeEcY8xASF+1JjyjNMS2J0vpuyy6I1lcO/ODOobxfQbxXvOWMT47US6Zzp0PVmKVaxkvJndJttoA8Cgpvuo4cUz5GXTfcuq++Qdw/6cNDhYr6TRRozv6RTDW8xZ9pysSUGX6py7dWadQN2fEjS5QTQArerSkEGtGnUkh0Idr1D1Sx8Rhlxwi1DPezxjPMaIceIwIGHkul5+j0J1r0CjAfFyCYM6hOvllG36cBi+JEMIU/dfRo+b4vUr8ZSyMzpWIjVcIrtHLO4w57PnU/Ij42XHbwj7p72/Dx14= 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: On 8/24/2023 12:51 PM, Huang, Ying wrote: > Baolin Wang writes: > >> On 8/22/2023 10:47 AM, Huang, Ying wrote: >>> Baolin Wang writes: >>> >>>> Hi, >>>> >>>> Currently, on our ARM servers with NUMA enabled, we found the cross-die latency >>>> is a little larger that will significantly impact the workload's performance. >>>> So on ARM servers we will rely on the NUMA balancing to avoid the cross-die >>>> accessing. And I posted a patchset[1] to support speculative numa fault to >>>> improve the NUMA balancing's performance according to the principle of data >>>> locality. Moreover, thanks to Huang Ying's patchset[2], which introduced batch >>>> migration as a way to reduce the cost of TLB flush, and it will also benefit >>>> the migration of multiple pages all at once during NUMA balancing. >>>> >>>> So we plan to continue to support batch migration in do_numa_page() to improve >>>> the NUMA balancing's performance, but before adding complicated batch migration >>>> algorithm for NUMA balancing, some cleanup and preparation work need to do firstly, >>>> which are done in this patch set. In short, this patchset extends the >>>> migrate_misplaced_page() interface to support batch migration, and no functional >>>> changes intended. >>>> >>>> In addition, these cleanup can also benefit the compound page's NUMA balancing, >>>> which was discussed in previous thread[3]. IIUC, for the compound page's NUMA >>>> balancing, it is possible that partial pages were successfully migrated, so it is >>>> necessary to return the number of pages that were successfully migrated from >>>> migrate_misplaced_page(). >>> But I don't find the return number is used except as bool now. >> >> As I said above, this is a preparation for batch migration and >> compound page NUMA balancing in future. >> >> In addition, after looking into the THP' NUMA migration, I found this >> change is necessary for THP migration. Since it is possible that >> partial subpages were successfully migrated if the THP is split, so >> below THP numa fault statistics is not always correct: >> >> if (page_nid != NUMA_NO_NODE) >> task_numa_fault(last_cpupid, page_nid, HPAGE_PMD_NR, >> flags); >> >> I will try to fix this in next version. > > IIUC, THP will not be split for NUMA balancing. Please check the > nosplit logic in migrate_pages_batch(). > > bool nosplit = (reason == MR_NUMA_MISPLACED); Yes, I overlooked this. Thanks for reminding. > >>> Per my understanding, I still don't find much value of the changes >>> except as preparation for batch migration in NUMA balancing. So I still >> >> IMO, only patch 3 is just a preparation for batch migration, but other >> patches are some cleanups for migrate_misplaced_page(). I can drop the >> preparation patches in this series and revise the commit message. >> >>> think it's better to wait for the whole series. Where we can check why >>> these changes are necessary for batch migration. And I think that you >>> will provide some number to justify the batch migration, including pros >>> and cons. >>> -- >>> Best Regards, >>> Huang, Ying >>> >>>> This series is based on the latest mm-unstable(d226b59b30cc). >>>> >>>> [1] https://lore.kernel.org/lkml/cover.1639306956.git.baolin.wang@linux.alibaba.com/t/#mc45929849b5d0e29b5fdd9d50425f8e95b8f2563 >>>> [2] https://lore.kernel.org/all/20230213123444.155149-1-ying.huang@intel.com/T/#u >>>> [3] https://lore.kernel.org/all/f8d47176-03a8-99bf-a813-b5942830fd73@arm.com/ >>>> >>>> Changes from v1: >>>> - Move page validation into a new function suggested by Huang Ying. >>>> - Change numamigrate_isolate_page() to boolean type. >>>> - Update some commit message. >>>> >>>> Baolin Wang (4): >>>> mm: migrate: factor out migration validation into >>>> numa_page_can_migrate() >>>> mm: migrate: move the numamigrate_isolate_page() into do_numa_page() >>>> mm: migrate: change migrate_misplaced_page() to support multiple pages >>>> migration >>>> mm: migrate: change to return the number of pages migrated >>>> successfully >>>> >>>> include/linux/migrate.h | 15 +++++++--- >>>> mm/huge_memory.c | 23 +++++++++++++-- >>>> mm/internal.h | 1 + >>>> mm/memory.c | 43 ++++++++++++++++++++++++++- >>>> mm/migrate.c | 64 +++++++++-------------------------------- >>>> 5 files changed, 88 insertions(+), 58 deletions(-)