From mboxrd@z Thu Jan 1 00:00:00 1970 Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.remote-ip=74.125.224.138 ARC-Seal: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=none; t=1796068953; b=MCoWWw9ZYY/pk6z3A2xLMKDuW3E69ZDggaPYPxgxtFsLakLb5unkYVQtPexXZgGJXQTs 5pmNnU9TOwZwezQdYl1NypOlbhXv1YucoTdnsZoSIx17/+VNkogf8/Rua+CFmlifiBdty IDNioNx7P/g0yah88mrtRktzVz+8NcJSSqWAlK9zWn5Q2p2kngQeQCMxXWcziJDaAT7UT fglw3lsr2nZ1GFiazK4dQJEweP0vUVVHoXqabBG9nv9MO/oEB654FKeMlBCBLLNEeYke5 jUFTUYd2exUlQ6Ps76TZqvy0ub5Jmpo/eWInhyT8xFHMyZIdHAyXE8xy2UOneyaroRA== ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1796068953; h=DMARC-Filter:Received:DKIM-Signature:X-Google-DKIM-Signature: X-Forwarded-Encrypted:X-Gm-Message-State:X-Gm-Gg:X-Received:Received: From:To:Cc:Subject:Date:Message-ID:X-Mailer:In-Reply-To:References: Content-Type:MIME-Version:Content-Transfer-Encoding; bh=d4PBCHGxTXE2Ghs1Z5kZGTSVr0KYbC4Mu74desEcwCs=; b=oLPVusi7N183f132A8pjfZDX/JMJFYqiTQKGTLMUn+KB1bjcQcHMiNWa7scUKKzonyiQ SOxlreF30Pjq7NpjyoqCZP0C/z0DtXlDzG81b0q+ayxcYmCejaxS3OeU2MBXPVL/y6qGz Z5xDA0ivqWNSC8q3jOSgrwcjk0BiZhbLMI6CmUpWthIIo1XIshtzlEE6h47C0Dj4rwfTp CqGkBypBqRQ0oRf7Up3c7btlamztJ51Fmbus4BH07drTnyU2zdYyIuiACkCiB28QHMjZs LZUtDjRQwPe5a4Df23kvX2mfIl8qEaQvNefhGkieu4r7GXCSANNhUUAh6S/Q2ZXCioA== ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass header.from=gmail.com; spf=pass smtp.mailfrom=gmail.com; dkim=pass header.d=gmail.com header.i=@gmail.com header.a=rsa-sha256 header.s=20260707 header.b=NMIDVciJ; arc=none smtp.remote-ip=74.125.224.138 Received: from mail-yx2-f10.google.com (mail-yx2-f10.google.com [74.125.224.138]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits) key-exchange X25519 server-signature ECDSA (prime256v1) server-digest SHA256) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id D150C606A31A for ; Mon, 30 Nov 2026 20:02:32 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.2 smtp.subspace.kernel.org D150C606A31A Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.a=rsa-sha256 header.s=20260707 header.b=NMIDVciJ Received: by mail-yx2-f10.google.com with SMTP id 00721157ae682-8b2fc584e77so18404937b3.1 for ; Mon, 30 Nov 2026 12:02:32 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20260707; t=1796068952; x=1796673752; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:content-type:references :in-reply-to:message-id:date:subject:cc:to:from:from:to:cc:subject :date:message-id:reply-to:content-type; bh=d4PBCHGxTXE2Ghs1Z5kZGTSVr0KYbC4Mu74desEcwCs=; b=NMIDVciJYKTQFBEj5Ll6SXB+iqyS482mIsVcprLVQhqpUJeyHAYKjLAJ0coH7pdc6i gKZs4V6+9GjhOmIPTO6W/CT+CstC5Vsl1eOOo9Fy1zJ3GE+03VfuFsK3TrUAlQe43YQq oySEwyPVv8xLWb+b5uzbssxcRyeMlkmm2QmVQZkIAxx3+8S51mDMqPJ6tiOSdu9xjoP7 L0Z3vivTR3eE0obeJwX9X0pbPiwxvgzKs7a7TJrL9lwwvh7hji5eI2gBztkcNcYHWfcW VR9P2C1rZGFDdC5xwKJa7D5GUzIx6Gu1KVv2rwlaQMSR8mKB1UqEwnTcUwu9xp4QQq4C lDrw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20260707; t=1796068952; x=1796673752; h=content-transfer-encoding:mime-version:content-type:references :in-reply-to:message-id:date:subject:cc:to:from:x-gm-gg :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to :content-type; bh=d4PBCHGxTXE2Ghs1Z5kZGTSVr0KYbC4Mu74desEcwCs=; b=lR3n1UxuEtdE1/pLq6fat1QrdhO5O8QelWOCVzxtvn8z/TDBH9maVtasIuCvwrN8Di petjfLhuA3JBIvUDEsfyJevsKW9fKqI3qzUH9HR8s6uQ7vF2borf0pXeec2nj7rL88By CNCsNn78gblJmDzCNh6iwsJGvtEjW8YIPOR5gqSt6kgUvnHT2FZKpc433dHiDYxulqG2 CkFb97moyje8A2VkuW8PJuQBXwcXVfcC7S0abG/O/tG1YZlN3rGHpw6CqxgsV0TH3XMd +HJiA8Soz1XtFyd+2rq8odLaQL5JdTWhYTlxv9SBHORGrkmZzgsttvzQgsna+o34IhxH IqOw== X-Forwarded-Encrypted: i=1; AL+hErE77hdfZp6XRZG3nMcJRCFYUr/AzKjvu1YkBQ3OkeiulTe2650SfoDDopNONZJKcVaqMucPz+GJwbDpwO8=@vger.kernel.org X-Gm-Message-State: APuU4Z+8qrUmJGxEEoAPRq8RC7hWNIwxzEDL7kuBfBTJ7SQGxD6dLdt+ L4f0eOFIKRE7VA5ZEwkItM6WfQD8UE8KpCo8ud3Sz5ZDVG+vj6MAt8Y= X-Gm-Gg: AZFdTZfxTFbH8EXMFYtiECwP9kVFemddnwbius+FhTLIaXlhqZbnTbvaj1kjvKbaIhu uxOw/kCSRU+dlcd6Sb2d0nFGM0ibqU+G6xLxAYYe3uWx2PAjJltd+4p2fN2/AH72EzTD8tQvAk3 5M5B2EcBt5LVR9wnnYznXL2vS9Ngy7bSQu9Ft+cyiBISZAvSzCJeQ3UA9O74u2i+B+x438JbnZF 1uikB8OIwlryOkPNG9+gqQ7ZSVc2kdFPJiO5evr3gAh5zeBh68yyn+sU+RyU8CtMQjtwm3zzmVI wwlxLMRvbsN54MdzVCGLTKHJueCTkAphmM9ZlL/NEuw/2kuSZPfst19/u+g0Pb6PJwF+c8a4sGG +gxRxdEPZIbfs8ye9eV+zweJANeqUHCgVXigEP9z+t/r6S2694pxhVK7rVKexpV/gC2ONoJkyLj uf/6IDRI0M5qDcYVxpJlzYlyhp2Qg8/8Sivs0pQLVmJDG5jDRGDClrUxn3Zl7f2dv3P7dGS+DQ3 qnuR3uPsdf7/A/770wqyoilpM2GQTdOuKAOrmCS8yEHjnTqq4wg7DiAgmS4A1YTweFVMTk8eHyc V9vX4uBjm2jlnHCNIMCraeaEXIJGqYotx5b4PJcvVpaQorR42vHI/3DZdqip8J6cgAYAevEpiNd moVn5U4mQVtqahmmE X-Received: by 2002:a05:690c:6a89:b0:8b4:e2dc:3f13 with SMTP id 00721157ae682-8b52043ba00mr128370737b3.30.1796068951771; Mon, 30 Nov 2026 12:02:31 -0800 (PST) Received: from localhost.localdomain ([2600:1700:4577:1050:df8:9709:d11b:8e64]) by smtp.gmail.com with ESMTPSA id 00721157ae682-8b520330e86sm135786677b3.38.2026.11.30.12.02.28 (version=TLS1_3 cipher=TLS_CHACHA20_POLY1305_SHA256 bits=256/256); Mon, 30 Nov 2026 12:02:31 -0800 (PST) From: Ravi Jonnalagadda To: Shivank Garg Cc: Andrew Morton , David Hildenbrand , Lorenzo Stoakes , Rik van Riel , "Liam R. Howlett" , Vlastimil Babka , Harry Yoo , Jann Horn , Lance Yang , Mike Rapoport , Suren Baghdasaryan , Michal Hocko , Zi Yan , Matthew Brost , Joshua Hahn , Rakie Kim , Byungchul Park , Gregory Price , Ying Huang , Alistair Popple , Joanne Koong , Karim Manaouil , Frank van der Linden , Kinsey Ho , Wei Xu , Bharata B Rao , David Rientjes , Dev Jain , Usama Arif , Miaohe Lin , linux-mm@kvack.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH v3 0/3] mm/rmap: batch the unmap of large folios during migration Date: Mon, 30 Nov 2026 12:02:27 -0800 Message-ID: <20261130200227.82773-1-ravis.opensrc@gmail.com> X-Mailer: git-send-email 2.54.0 In-Reply-To: <20261126-migrate-rmap-batch-v3-0-4112998fb472@amd.com> References: <20261126-migrate-rmap-batch-v3-0-4112998fb472@amd.com> Content-Type: text/plain; charset="us-ascii" X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Post: List-Help: List-Subscribe: List-Unsubscribe: List-Owner: Precedence: list MIME-Version: 1.0 Content-Transfer-Encoding: 8bit On Thu, 26 Nov 2026 09:53:00 +0000, Shivank Garg wrote: > This series lets try_to_migrate_one() convert a batch of consecutive PTEs > that map the same large folio in one go, mirroring what > try_to_unmap_one() already does, with some refactoring on the way. Hi Shivank, I tested v3 on an AMD EPYC system, migrating between DRAM and CXL memory. The gains have the shape of your Zen5 table. How I tested ------------ - An AMD EPYC system with DRAM and a CXL Type 3 memory expander, booted with mitigations=off as in your runs. - Base kernel: your base, mm-core for-next 518cbccb58e4 with Dev's v5 [1]. Each result compares it without and with v3. - move_pages() of 1 GiB of anonymous memory, one mTHP size at a time, between DRAM and CXL in both directions. - GB/s = 1 GiB / wall time of the move_pages() call. Every word is checked after each move. What I saw ---------- On the base kernel: folio | without v3 | with v3 | gain | try_to_migrate() ms ------+------------+------------+---------+-------------------- 4K | 4.77 GB/s | 4.81 GB/s | +0.9 % | 42.5 -> 41.6 16K | 7.28 GB/s | 8.36 GB/s | +14.8 % | 35.2 -> 19.4 64K | 9.18 GB/s | 11.18 GB/s | +21.9 % | 34.4 -> 15.3 256K | 9.66 GB/s | 13.22 GB/s | +36.9 % | 36.1 -> 6.4 1M | 10.15 GB/s | 13.54 GB/s | +33.5 % | 32.9 -> 6.0 2M | 17.61 GB/s | 17.30 GB/s | -1.7 % | 0.33 -> 0.32 - try_to_migrate() time drops the same way as in your profile. - 2M is PMD-mapped and unchanged within noise. With the copy offloaded to DMA, the batching matters more, as your v2 cover expected. For this I used an offload kernel: the base kernel plus your offload series v6, with dcbm holding its DMA channels while offloading is enabled (results in [2], code in [3]), on an AMD SDXI engine. On the offload kernel, CPU copy and DMA copy, each without and with v3: folio | copy | without v3 | with v3 | gain ------+------+------------+------------+-------- 256K | CPU | 9.73 GB/s | 12.31 GB/s | +26.5 % 256K | DMA | 15.53 GB/s | 23.83 GB/s | +53.5 % 1M | CPU | 10.08 GB/s | 12.66 GB/s | +25.5 % 1M | DMA | 16.21 GB/s | 25.54 GB/s | +57.6 % The offload kernel moves the whole 1 GiB in one batch (v6 5/5), so its CPU numbers are not comparable with the base kernel's table. Tested-by: Ravi Jonnalagadda Thanks, Ravi [1] https://lore.kernel.org/linux-mm/20261123053543.295467-1-dev.jain@arm.com/ [2] https://lore.kernel.org/all/20261128224616.66122-1-ravis.opensrc@gmail.com/ [3] https://lore.kernel.org/all/20261128225943.66318-1-ravis.opensrc@gmail.com/