From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from out30-131.freemail.mail.aliyun.com (out30-131.freemail.mail.aliyun.com [115.124.30.131]) (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 2579E1F92E for ; Fri, 27 Feb 2026 09:44:53 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=115.124.30.131 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1772185497; cv=none; b=V1IyoFfBPpRoa3q9v9lSyc3cPbbx2uxQRokui0ULJGzAVkMRqsxvZvq0ut/dboRlydpGC4yd8sTBxPzBkAMknWCgJD7TUlvcwMdVa8uER1fObDT3ehj0r1rqiusb+xG7wmQ3tAfgnipXt4a9kvL6soAxPZhTGh49by/bKvys8uc= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1772185497; c=relaxed/simple; bh=lsYttDZC9JL4rW8Nc3HuAuSWCwwPIt8Y4A3iP5DqjGY=; h=From:To:Cc:Subject:Date:Message-ID:MIME-Version:Content-Type; b=WbZqAULxDAF6G1jC7igsDJwM991kzZKh8AxHaJNB08j0KNrBGFmcaGZUo12/nOVDK93P4V31erajtwvo1iGdgFSg/q6nHDdE0dP5kulHSF+Vna9bRQJmYtWcqybY4q9RTPUJyvEZMiqkOtzE6KO5To7dTkbZ0+7Vivqn0SYUVhk= 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=iq7tHb7X; arc=none smtp.client-ip=115.124.30.131 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="iq7tHb7X" DKIM-Signature:v=1; a=rsa-sha256; c=relaxed/relaxed; d=linux.alibaba.com; s=default; t=1772185491; h=From:To:Subject:Date:Message-ID:MIME-Version:Content-Type; bh=X8e+sid83UVQcVbpwgH4NtgpV2iaHgcz/z9sPbv8Yyw=; b=iq7tHb7XH4BXDcUlMBgt85xA3FidCEhweA8N0l4i6DJ7UUCgj0qxRb4DhfKxeFBx0HYr19oe+CoOLyGpOgdy0Hpyw4GIqiT3c8Tciiu279q9/W0t43Wd5+Gz2lEANYnDZOb2M5m0hWkyD3G/WgzBU5VfzcG8VZ85feuRANNZ+0Q= Received: from localhost(mailfrom:baolin.wang@linux.alibaba.com fp:SMTPD_---0Wzu.cBW_1772185489 cluster:ay36) by smtp.aliyun-inc.com; Fri, 27 Feb 2026 17:44:50 +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 v2 0/6] support batched checking of the young flag for MGLRU Date: Fri, 27 Feb 2026 17:44:34 +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 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 | 38 ++++++++++++++++++++++ mm/internal.h | 52 ++++++++++++++++++++++++++++++ mm/rmap.c | 29 ++++++++--------- mm/vmscan.c | 46 ++++++++++++++++++++------- 7 files changed, 154 insertions(+), 88 deletions(-) -- 2.47.3