From patchwork Tue Aug 22 00:53:48 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Baolin Wang X-Patchwork-Id: 13360019 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 13BC3EE49A6 for ; Tue, 22 Aug 2023 00:54:15 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 3D72194000B; Mon, 21 Aug 2023 20:54:15 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 36046940008; Mon, 21 Aug 2023 20:54:15 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 200C594000B; Mon, 21 Aug 2023 20:54:15 -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 0F0C3940008 for ; Mon, 21 Aug 2023 20:54:15 -0400 (EDT) Received: from smtpin15.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay03.hostedemail.com (Postfix) with ESMTP id D9804A0174 for ; Tue, 22 Aug 2023 00:54:14 +0000 (UTC) X-FDA: 81149919228.15.F48837C Received: from out30-119.freemail.mail.aliyun.com (out30-119.freemail.mail.aliyun.com [115.124.30.119]) by imf16.hostedemail.com (Postfix) with ESMTP id 27226180011 for ; Tue, 22 Aug 2023 00:54:11 +0000 (UTC) Authentication-Results: imf16.hostedemail.com; dkim=none; dmarc=pass (policy=none) header.from=alibaba.com; spf=pass (imf16.hostedemail.com: domain of baolin.wang@linux.alibaba.com designates 115.124.30.119 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=1692665653; 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; bh=/aBVbB+Tu74xJDFWbv8zg3BiNT7LOcAazqgrJqmYe3Q=; b=cOcurrqHGwn3ug9xt08NJbyl+b1RxlNuMfnoYH9MEqTaEctOSwxXfiMPxoNvWSLO/9V8Eg F/qYAZOQOhqp3HlZMKhVPmQA7/LPwdoQYV0nfdeCwFgSHo919VgtC2z2IreY5bFyKY5sbZ nwCz08hEq7Z1Wv0F7rML6jLsf6qJk2M= ARC-Authentication-Results: i=1; imf16.hostedemail.com; dkim=none; dmarc=pass (policy=none) header.from=alibaba.com; spf=pass (imf16.hostedemail.com: domain of baolin.wang@linux.alibaba.com designates 115.124.30.119 as permitted sender) smtp.mailfrom=baolin.wang@linux.alibaba.com ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1692665653; a=rsa-sha256; cv=none; b=5bSQos5DZknmWqLC61EFo7gChWjrRx4MdmYaTmZucm5AbCFrq4FYpAye82pq4fV8nHnuhO z4mqJsZ2GY2O7UTS3DGRcfR5kIaYKCyPU1WO0wiGudpldSmQCgKmKEoDplAoN0JAH/GLjL BV4F/yYfuL0QCpWdYpKt82AVIKJNktk= X-Alimail-AntiSpam: AC=PASS;BC=-1|-1;BR=01201311R401e4;CH=green;DM=||false|;DS=||;FP=0|-1|-1|-1|0|-1|-1|-1;HT=ay29a033018046049;MF=baolin.wang@linux.alibaba.com;NM=1;PH=DS;RN=8;SR=0;TI=SMTPD_---0VqK0DOL_1692665646; Received: from localhost(mailfrom:baolin.wang@linux.alibaba.com fp:SMTPD_---0VqK0DOL_1692665646) by smtp.aliyun-inc.com; Tue, 22 Aug 2023 08:54:07 +0800 From: Baolin Wang To: akpm@linux-foundation.org Cc: mgorman@techsingularity.net, shy828301@gmail.com, david@redhat.com, ying.huang@intel.com, baolin.wang@linux.alibaba.com, linux-mm@kvack.org, linux-kernel@vger.kernel.org Subject: [PATCH v2 0/4] Extend migrate_misplaced_page() to support batch migration Date: Tue, 22 Aug 2023 08:53:48 +0800 Message-Id: X-Mailer: git-send-email 2.39.3 MIME-Version: 1.0 X-Rspam-User: X-Rspamd-Server: rspam12 X-Rspamd-Queue-Id: 27226180011 X-Stat-Signature: cmnrk899z9acb5rnfkzm4yaqengmmtre X-HE-Tag: 1692665651-876365 X-HE-Meta: U2FsdGVkX1+1gs3rr5yJd8ZhxaAzaU+8OhVTjbbQc6dNwk3lRdCLu7I2NwZsBvmjzrFrrJciLLi3tHZk+b8r6x2MQmGF1DY3aQf+CEWb5+YeIJbcuJszht3nmJ/9Hh0cou5pD2NMpmKVE/46dDaZknJ1hm+GiF7jlv2Bo4hU/y4P3b5zwG+mqcRf2d8SaxhBOafMoC8YBa4CuafXKoforwESFSbf8d3oxfaZftgSqwEz2vt7xPdpRn0OQVRd5p9qjXLNp8Hzdg7f7F3TttJ5uyqHHxLQJIYRFzdVpIlCAyvchKRkDcYmneZSwtyt5aj1NOOTRlwGENPWcRSfzyCxZvPiCnWyP+SfuN7gDm2YONFd4a881SmFNXSsWkN0pQ9ioI/XWodLZJH6oy96+UCgB4htq21shS+nv3EEDdR3m3QKX4DXJ7eP9bKO8NAkcv+T25EtzOcLMAvzNOejgantbPQrYVqfXZV49dNldP2CfdmJRhCgg2h9Kk1CGMtxxcC7BC9Ws/IZUfsIp56oQTDdmyxivUklE2975a1Myoi8X+0FcXYer5byD2sWu5j4LEl34NraUoyxbNdzd54teR5in8Whx8Hl9clBUR8A4D1B9/EQn0HdrFiyDPm2jVwp9d5cBiP8UNgxzFP7DS3owxEiNRXKtIZODtn5gejaZGnYIghYWdJApe1s4WCLB3C7D0ZBi9gwSdRWhxL4ipBZc8uIoXGcIXywOEozQtZpTRUQclWS1MVKQ16uY+Taphlq7s7kbuRxaHHdHTnzDATv5yEFTqrkgUOZP4yuasB5ynVN0H2KVls8M8jAyPsfzB/Z3sKQrMKJETHVJNCQEZLIn8Qd83Ae+cmcumIPOvYPr7PTvJM8naNb8VRynCpHtADJTCge34509htmaJCu7VCViwHJjrfMsO601fr5s/mM5dgSaMpcumA1TE1833NNVmGGTdojkGIxyF5Q8BUDvKo2V9K 7FZuJUZ5 ZiBsToGtDSXI7uq3U9lmLDgTi0MB8/ymqRm70NmHMKEylxlPRkH3f0OS8tewoePG+tUitRfxaiH3xMjWkXnpTiwk//AigWMwxCnkp9VFXa9IMJWfeTu1uvBMsaY34Yua4D8e4DfLuLe4kPl6rGGOH4B1ZN6a01O7jEzkFFDEbgUPKAb6+MhLsuxU+SRvS3/psODhVLG9fikrn0CkwIaZ2N7hi32TctRhEn1hFzwr/oppxxG+TKW85Hft9jrjmNOk5B0f0gpAfcZW5/xN/FKr8B4ftLmlWD5NTsafg 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: 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(). 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(-)