From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from out30-113.freemail.mail.aliyun.com (out30-113.freemail.mail.aliyun.com [115.124.30.113]) (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 317ED20C461 for ; Fri, 6 Mar 2026 06:44:01 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=115.124.30.113 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1772779445; cv=none; b=JoUsvNoaSUZfHHUMqCkgbp9BbiUPRnyoOtGbl0gPHtvFiDWWi4/arxtLw0lDu2+TxgdbbK+R577/t/dulgJvHuFq5H609gihFaCkNhVCuHnj2BlSrd5NDhXIKb680stiXYcgi1RY3qUOoklNeWdchwxXn7Bb9b4tryuQC48nL38= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1772779445; c=relaxed/simple; bh=j1ACzNcboFdwGyxHNUQtvIPPegdUagrAeL7bew7SMSY=; h=From:To:Cc:Subject:Date:Message-ID:MIME-Version:Content-Type; b=hCJf4aHFSX+x7j/s2zNV+EbrQiHbcQxSrYUFmT9x0dVioVUMc73tTrZ1rw9WY4bIIKwlCYahk5ucjJ4DEckAYpsdIn1gOdoH0BMVmAWxiXFpLXfG/9bbji3/IWLBfztKRtBuFYzaQiO/5GfgHFM+WZlHfurWTmuFvaZNzWubuOs= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.alibaba.com; spf=pass smtp.mailfrom=linux.alibaba.com; dkim=pass (1024-bit key) header.d=linux.alibaba.com header.i=@linux.alibaba.com header.b=XKOjkLQf; arc=none smtp.client-ip=115.124.30.113 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.alibaba.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=linux.alibaba.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linux.alibaba.com header.i=@linux.alibaba.com header.b="XKOjkLQf" DKIM-Signature:v=1; a=rsa-sha256; c=relaxed/relaxed; d=linux.alibaba.com; s=default; t=1772779439; h=From:To:Subject:Date:Message-ID:MIME-Version:Content-Type; bh=CmeKu3kFQGo6glaHzn6GIz9FtScBZUYLt4OdvSQRdYA=; b=XKOjkLQfJHLTA6kHG2D7poNWckHMKKWLjxfx3k0iqA8oT7ZUWjtFQlExB1pnxzeS5PXRJHuqQLahWyrYHQuxhc1slfQQybsL7ziRWKOpHxYBOdVTgcyx9HopH/SdrK4pSzRow8LjOiAsAu/iGumMvhRgi7+fD5SxSgCp/7l02AU= Received: from localhost(mailfrom:baolin.wang@linux.alibaba.com fp:SMTPD_---0X-ML2rg_1772779436 cluster:ay36) by smtp.aliyun-inc.com; Fri, 06 Mar 2026 14:43:57 +0800 From: Baolin Wang To: akpm@linux-foundation.org, david@kernel.org Cc: catalin.marinas@arm.com, will@kernel.org, lorenzo.stoakes@oracle.com, ryan.roberts@arm.com, Liam.Howlett@oracle.com, vbabka@suse.cz, rppt@kernel.org, surenb@google.com, mhocko@suse.com, riel@surriel.com, harry.yoo@oracle.com, jannh@google.com, willy@infradead.org, baohua@kernel.org, dev.jain@arm.com, axelrasmussen@google.com, yuanchu@google.com, weixugc@google.com, hannes@cmpxchg.org, zhengqi.arch@bytedance.com, shakeel.butt@linux.dev, baolin.wang@linux.alibaba.com, linux-mm@kvack.org, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org Subject: [PATCH v3 0/6] support batched checking of the young flag for MGLRU Date: Fri, 6 Mar 2026 14:43:36 +0800 Message-ID: X-Mailer: git-send-email 2.47.3 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=UTF-8 Content-Transfer-Encoding: 8bit This is a follow-up to the previous work [1], to support batched checking of the young flag for MGLRU. Similarly, batched checking of young flag for large folios can improve performance during large-folio reclamation when MGLRU is enabled. I observed noticeable performance improvements (see patch 5) on an Arm64 machine that supports contiguous PTEs. All mm-selftests are passed. Patch 1 - 3: cleanup patches. Patch 4: add a new generic batched PTE helper: test_and_clear_young_ptes(). Patch 5: support batched young flag checking for MGLRU. Patch 6: implement the Arm64 arch-specific test_and_clear_young_ptes(). [1] https://lore.kernel.org/all/cover.1770645603.git.baolin.wang@linux.alibaba.com/ Changes from v2: v2: https://lore.kernel.org/all/cover.1772185080.git.baolin.wang@linux.alibaba.com/ - Update the commit message of patch 5 (per David). - Fix some coding style issues (per David). - Remove 'cur_pte' variable in lru_gen_look_around() (per David). - Move 'ptes += nr;' to the suitable place in folio_referenced_one() (per David). - Add acked tag from David. Thanks. Changes from v1: v1: https://lore.kernel.org/all/cover.1771897150.git.baolin.wang@linux.alibaba.com/ - Update some commit message (per David). - Fix some coding style issues (per David). - Use VM_WARN_ON_ONCE_FOLIO() instead of VM_WARN_ON_FOLIO() (per Rik). - Define a generic ptep_test_and_clear_young_notify() (per David). - Remove redundant 'nr > 1' check in folio_referenced_one() (per David). - Rename some variables' to make code more clear (per David). - Add a new patch to rename some functions (per David). - Update the young counters with the batched count for MGLRU. - Collect reviewed tags from Rik, Barry, Alistair and David. Thanks. Baolin Wang (6): mm: use inline helper functions instead of ugly macros mm: rename ptep/pmdp_clear_young_notify() to ptep/pmdp_test_and_clear_young_notify() mm: rmap: add a ZONE_DEVICE folio warning in folio_referenced() mm: add a batched helper to clear the young flag for large folios mm: support batched checking of the young flag for MGLRU arm64: mm: implement the architecture-specific test_and_clear_young_ptes() arch/arm64/include/asm/pgtable.h | 18 +++++++---- include/linux/mmu_notifier.h | 54 -------------------------------- include/linux/mmzone.h | 5 +-- include/linux/pgtable.h | 37 ++++++++++++++++++++++ mm/internal.h | 52 ++++++++++++++++++++++++++++++ mm/rmap.c | 29 ++++++++--------- mm/vmscan.c | 45 +++++++++++++++++++------- 7 files changed, 152 insertions(+), 88 deletions(-) -- 2.47.3