From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mail-yw1-f180.google.com (mail-yw1-f180.google.com [209.85.128.180]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id A8647433E60 for ; Mon, 24 Aug 2026 14:18:30 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.128.180 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1787581112; cv=none; b=A8mkdXPyWJuK+vb4Mqd/yiKG6E6e9H3qUo54cX2xuNnSLUIngEX9vE1zgvW31d18D5xKcMTwgoJAcbBnG/JRMPpPsQyEnObQB5rS8djUJsJPwNTMkgQpsx48dOzmmTMEogweloNlRhO/5ouVFSVtImsKVN3DF1Ingn3IP1Wk2zI= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1787581112; c=relaxed/simple; bh=NXqB4cq2up2lZFmd8LXQWlaLoQrbIuSlvHGTMlBcpMo=; h=Date:From:To:cc:Subject:In-Reply-To:Message-ID:References: MIME-Version:Content-Type; b=r6Eb8dsjdL9hnfdFZjpglPmThwf73/I6Np58BZSKh+doWAM79cyr8nZihAHpGJ39ZtwERmy3RUCUlCleJekf+Y7t2G71nfsZXlj3clTWtQH4nNOWIRP5+Smx8FqoCoMX1+n+LbuTT1d64MAP4KFDvnWpNJzouh3zVgp/r1alALA= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=google.com; spf=pass smtp.mailfrom=google.com; dkim=pass (2048-bit key) header.d=google.com header.i=@google.com header.b=iEWFyp2f; arc=none smtp.client-ip=209.85.128.180 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=google.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=google.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=google.com header.i=@google.com header.b="iEWFyp2f" Received: by mail-yw1-f180.google.com with SMTP id 00721157ae682-8111c0c7561so52248657b3.3 for ; Mon, 24 Aug 2026 07:18:30 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20251104; t=1787581109; x=1788185909; darn=vger.kernel.org; h=content-type:mime-version:references:message-id:in-reply-to:subject :cc:to:from:date:from:to:cc:subject:date:message-id:reply-to :content-type; bh=p1RKlgv7gfcdgd0R95YOF5t38k1glOotR90LR4kTqgc=; b=iEWFyp2fObpGuMxuC3AxmU+tN6T5R0BSy85FKMQOYOj0zD6eb+5TZ4Gy9kkRrUDX7l sBfXgKGoB5BlSlq9Vy+xXpe8N12y8g65QcgEfOhdRO+FxdanYmLBwx4XdJJmTcPmDS/Q k8oHz8e4apoTLoFfrpoYRsKudobrDwWUEBbYKJW2o2P4WxYhb0UE1yWHQnxb4DbdB4Z1 MQf0SEv65ZzjkonEMzDdolDCxFGDabCQZg1WG6z5hXp5qimSXeSTii8THmYsmArGmCxI oqSgx3CpTY7Ls0wUnBdq1CQ9s8ZZbJlvOZ9KQbaQJDUQmshkCWvEPZoNw8thg2V5cBJg /TVg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1787581109; x=1788185909; h=content-type:mime-version:references:message-id:in-reply-to:subject :cc:to:from:date:x-gm-gg:x-gm-message-state:from:to:cc:subject:date :message-id:reply-to:content-type; bh=p1RKlgv7gfcdgd0R95YOF5t38k1glOotR90LR4kTqgc=; b=a8Ev6Zz2GlaRy+iAe2fw18eMLqQ5yNg4SJpw7A1b6vhwwVrwihf3oQdQbZNrAT/N2Q T14wDubDWO7armnFCYVj42VCRrB0LIXex+W9Nl75bDxGGgttlkZLjIS+0zvzSeLe2HVc zHcoVEO8zg1ZQ1DqBxw7oP1DRWWM98VKyQGnd9oHOuuUgcmqJ5l4Jgb+Vd2bRo6qJ3V8 ZVwVXMtoAgaF9mqGtekFXXuN6b06uMpLiZs15SkKZHhadTU5HwtbQjjLTSgMF1Ls21VW 30HFcD8BBdgl0zTWNfgoDraG4JEr+dINAEVA68Z/OJOKKAlYCuZ3ydnrnTzAEYGghRfo lizg== X-Forwarded-Encrypted: i=1; AHgh+Ro2haicYlxTXUJ9jBFe9jTPJy7jKLl/IMZrEzeT+hT/vtuudXhfGAbCChmqgHWa89XaiWOE5TNKrRo1KL0=@vger.kernel.org X-Gm-Message-State: AFuF++nSSyy6uUTyThLZfcnSYx/oomK8JZr83Vo8YFvJBWfF0zJ6LStr ualz5VXDckq8gdvXNYmugB53gIvb+Y3mUyjby0z1g10j15Vk6ZzFP5hjhx+Mro+tcA== X-Gm-Gg: AR+sD12B0aVZMI8ezVAJ1yVDD3kD3FZZVYIiJYLhAo0Y+L+py+FV5m2CdnsMQabBlM5 oivoM0mKgSsdcEj/nwlv0ub7K2tX2UkpXSQKIRyPrU963XYlh/ON5DOQRaYKtBt0c2Jc+qt7HOY gaI0f7VsdQjmUKzRFydqDDpWNhkDUJmfgDRsp1tSwIMaHKfS63uPzLDVxC7sEd3V56SEZ2vXB9a APgFBrRqlpRF/F/xvdPJulFBe9+wrct95n/MC2HmOekgWT4y2IgFSkBQVdCxSXh5X8ExyXz2GN4 +/uIs5tKX1K+47NASAq2+0oMbSAhbOd4fW0i6NudLavU5eTWOvJqT1gcRcnjXEtR/uNDGlukoq1 zIXWbHriTs44JdYtqdLuAe6FqYjbyW01RgGUhuhSxoa001wX8vDFLB2z2NVXs2eU9hvyRPUFIrH eEhxHFP8BGQ6k8WPUzSCUyxD18lupwvpUX7/f80qilwJ10s6k41mL/f0VguIlp9QkCr167JWoPt xKDV931GNHJSzrvIio0NSv1ajn+sXx+HUgiqI2w9H0cDvIZ X-Received: by 2002:a05:690c:e0d5:10b0:821:1013:b420 with SMTP id 00721157ae682-849f090e309mr91327927b3.2.1787581108999; Mon, 24 Aug 2026 07:18:28 -0700 (PDT) Received: from darker.attlocal.net (172-10-233-147.lightspeed.sntcca.sbcglobal.net. [172.10.233.147]) by smtp.gmail.com with ESMTPSA id 00721157ae682-8542a633964sm1660667b3.37.2026.08.24.07.18.25 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 24 Aug 2026 07:18:28 -0700 (PDT) Date: Mon, 24 Aug 2026 07:18:24 -0700 (PDT) From: Hugh Dickins To: Andrew Morton cc: Ackerley Tng , Alexander Viro , Baolin Wang , Barry Song , Binbin Wu , Christian Brauner , Christoph Hellwig , Christoph Lameter , Claudio Imbrenda , David Hildenbrand , JP Kobryn , Jan Kara , Jens Axboe , Johannes Weiner , Kairui Song , Kiryl Shutsemau , Lance Yang , Leonardo Bras , Lorenzo Stoakes , Marcelo Tosatti , Matthew Wilcox , Mel Gorman , Miaohe Lin , Michal Hocko , Minchan Kim , Muchun Song , Oscar Salvador , Peter Zijlstra , Qi Zheng , Rik van Riel , Sebastian Andrzej Siewior , Shakeel Butt , Suren Baghdasaryan , Vlastimil Babka , Yang Shi , Yu Zhao , Zach O'Keefe , Zi Yan , linux-block@vger.kernel.org, linux-fsdevel@vger.kernel.org, linux-kernel@vger.kernel.org, linux-mm@kvack.org Subject: [PATCH 11/25] mm/fbatch: remove migration's PAGE_WAS_MLOCKED lru_add_drain() In-Reply-To: <14a16945-529b-8bc0-ab38-3ea97e54e223@google.com> Message-ID: <6b1ccb51-be6d-5f1b-147c-771e6adaf55c@google.com> References: <14a16945-529b-8bc0-ab38-3ea97e54e223@google.com> 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=US-ASCII A welcome side-effect of mm/mlock.c's mod_mlock_count() succeeding on folios on the per-cpu lru_add fbatch, is that migrate_folio_move() no longer has to lru_add_drain() before remove_migration_ptes() restores a PAGE_WAS_MLOCKED mlock_count: so remove PAGE_WAS_MLOCKED altogether. Re the "We would like to do something similar for the old page, when unsuccessful" comment above it: that may be easier now, but involve some rearrangement: not researched, so just leave the comment as is. Signed-off-by: Hugh Dickins --- mm/migrate.c | 8 +------- 1 file changed, 1 insertion(+), 7 deletions(-) diff --git a/mm/migrate.c b/mm/migrate.c index 6b71b2415d00..534908a0839a 100644 --- a/mm/migrate.c +++ b/mm/migrate.c @@ -1148,8 +1148,7 @@ static int move_to_new_folio(struct folio *dst, struct folio *src, */ enum { FOLIO_WAS_MAPPED = BIT(0), - FOLIO_WAS_MLOCKED = BIT(1), - FOLIO_OLD_STATES = FOLIO_WAS_MAPPED | FOLIO_WAS_MLOCKED, + FOLIO_OLD_STATES = FOLIO_WAS_MAPPED, }; static void __migrate_folio_record(struct folio *dst, @@ -1259,8 +1258,6 @@ static int migrate_folio_unmap(new_folio_t get_new_folio, folio_lock(src); } locked = true; - if (folio_test_mlocked(src)) - old_folio_state |= FOLIO_WAS_MLOCKED; if (folio_test_writeback(src)) { /* @@ -1411,9 +1408,6 @@ static int migrate_folio_move(free_folio_t put_new_folio, unsigned long private, * isolated from the unevictable LRU: but this case is the easiest. */ folio_add_lru(dst); - if (old_folio_state & FOLIO_WAS_MLOCKED) - lru_add_drain(); - if (old_folio_state & FOLIO_WAS_MAPPED) remove_migration_ptes(src, dst, 0); -- 2.51.0