From mboxrd@z Thu Jan 1 00:00:00 1970 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 02959CF397B for ; Fri, 20 Sep 2024 01:17:54 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 4C9FE6B0082; Thu, 19 Sep 2024 21:17:54 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 479756B0083; Thu, 19 Sep 2024 21:17:54 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 341306B0085; Thu, 19 Sep 2024 21:17:54 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0017.hostedemail.com [216.40.44.17]) by kanga.kvack.org (Postfix) with ESMTP id 112D76B0082 for ; Thu, 19 Sep 2024 21:17:54 -0400 (EDT) Received: from smtpin30.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay08.hostedemail.com (Postfix) with ESMTP id A96871410E8 for ; Fri, 20 Sep 2024 01:17:53 +0000 (UTC) X-FDA: 82583354826.30.419143C Received: from mail-vk1-f176.google.com (mail-vk1-f176.google.com [209.85.221.176]) by imf16.hostedemail.com (Postfix) with ESMTP id D1F28180004 for ; Fri, 20 Sep 2024 01:17:51 +0000 (UTC) Authentication-Results: imf16.hostedemail.com; dkim=pass header.d=gmail.com header.s=20230601 header.b=B1EHWGC0; spf=pass (imf16.hostedemail.com: domain of 21cnbao@gmail.com designates 209.85.221.176 as permitted sender) smtp.mailfrom=21cnbao@gmail.com; dmarc=pass (policy=none) header.from=gmail.com ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1726795039; 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-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references:dkim-signature; bh=wX7VnUBV70ok1CsWs4uuxCawlBRamTI320cKATVeV/U=; b=TZom61Zqy2KJHyvXFt+7VDUDS5jDz7mer1gL5CYoXQn4rfNQvbVMhVI+jBZzQnyPeGdeCp q50K7/3XceKXS27huj/NKSFFXnZNN1JCe29I3NfupGZHRMXlrNJHQmYIyAyaLdz+2xVKu5 ooP0GSbdr1/XsMEkNaT3gxtaAtnaX7c= ARC-Authentication-Results: i=1; imf16.hostedemail.com; dkim=pass header.d=gmail.com header.s=20230601 header.b=B1EHWGC0; spf=pass (imf16.hostedemail.com: domain of 21cnbao@gmail.com designates 209.85.221.176 as permitted sender) smtp.mailfrom=21cnbao@gmail.com; dmarc=pass (policy=none) header.from=gmail.com ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1726795039; a=rsa-sha256; cv=none; b=bMqVp7Xw5qQPhobp48eDZNx7wfyuc4efdVnqu1mrhpD4MfsxokwKwFL0/h31LHZTv9C/zq /r0kpVWJ2+o5tgSZX+Pgb9AHady1li6DzdTn+ZpJKQ/Oeg23e1AA4hf9TR8DpnSaZNkcEw MXUaKlbBTHXF+zzaTL475kf/onejQOM= Received: by mail-vk1-f176.google.com with SMTP id 71dfb90a1353d-502adfff6fdso427657e0c.1 for ; Thu, 19 Sep 2024 18:17:51 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1726795071; x=1727399871; darn=kvack.org; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:from:to:cc:subject:date :message-id:reply-to; bh=wX7VnUBV70ok1CsWs4uuxCawlBRamTI320cKATVeV/U=; b=B1EHWGC0+93yKXht54mkbiVhJBItQw1NjKcDReatnnwhx/JLJNjkxMv+j9TbQ5Y/GH c3fGor3PZDeXk5xEVKBUll5Nhe1obtL0Y1E2Uge1RTKgttQSNYs12hlDD9aTAvmW3yXh RNR9x0AxbWqlYVWqHHDnzH0F36Qvx2ATEgmINQSS+7L/pHwtYDx2h3kzIkTOY20XSiTr Su5knPIWkPTdAuyiBQbB6PVvUZqnayu6nJIiwpKXO0Qa9Z/sjhc/ILwWuZlW5COBqWeT ZIp/pUQu/O38GzrtGNTiu3ZZEJtUIObP9maA7gPXdf2adER4ipz46ktTIQyg6DBryPb9 Uftg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1726795071; x=1727399871; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=wX7VnUBV70ok1CsWs4uuxCawlBRamTI320cKATVeV/U=; b=OoVlWGo5ezjERl0rB6eQ1jr/gmbi5jjpjpI/rxSxNdvWzW8sMek8kytD1egG10iAR8 hV2JO6bk5aHlfQkQfu/HyRuHRdE27VqizBi7KgQnrbd80AWyBgF9GU9vOCY5GMVi9RnE reNzWnLfNq37DTAOKJW0sSmlI+dxUAjP7JMCDRNvXZgJxIUeyU9GL+PJjfPWQmWQGHCa v8HBl8/Mf6mICe7j+y4gvKztmunhBRzN5oFW9kqAIDLZz9it5ayQu25a98JBqr9jzxH0 GgfQrvZgxb9msV03SFbmXGnXDQJAjzU9MRsmonIBdP2vMkcA9JNdd6av8VbsEl8gslwB mp3g== X-Forwarded-Encrypted: i=1; AJvYcCU7uGIfcEB5xm/wxKCjRsLnDsZbARlCQsDsufbMX9VUaRbfsm/sATcXzB3wEmV8HZ4Todbmm+lECA==@kvack.org X-Gm-Message-State: AOJu0YzeJPFkdCywMZVJGXC/zgwEoR22mCEPjmWJIb2qdSFpfqEoEKlS 2ZKQIHnWm8ptd62Y/AouH4HahVwmT+ZWktCBNdLGHMn04AKNMnlLt48wrbem+KF5m/hDUeI6PCH Xoxpi28jY/IvJ81JS1vVaxbPu218= X-Google-Smtp-Source: AGHT+IGOFrA8BORH1lrZai9uzR4jQVe3Xr7M5V6raCquF3aTBK+AZJv5OSZMmT9HE6qg7PHykUqSgfyPKGDZIXpjchQ= X-Received: by 2002:a05:6122:1826:b0:502:6d58:4501 with SMTP id 71dfb90a1353d-503e03c1293mr1562857e0c.2.1726795070694; Thu, 19 Sep 2024 18:17:50 -0700 (PDT) MIME-Version: 1.0 References: <20240914063746.46290-1-21cnbao@gmail.com> <02ff6c8e2199487b9d43ad2aa1fd813a@honor.com> In-Reply-To: <02ff6c8e2199487b9d43ad2aa1fd813a@honor.com> From: Barry Song <21cnbao@gmail.com> Date: Fri, 20 Sep 2024 13:17:39 +1200 Message-ID: Subject: Re: [PATCH RFC] mm: mglru: provide a separate list for lazyfree anon folios To: gaoxu Cc: "akpm@linux-foundation.org" , "linux-mm@kvack.org" , "mhocko@suse.com" , fengbaopeng , "hailong.liu@oppo.com" , "kaleshsingh@google.com" , "linux-kernel@vger.kernel.org" , "lokeshgidra@google.com" , "ngeoffray@google.com" , "shli@fb.com" , "surenb@google.com" , yipengxiang , "david@redhat.com" , "yuzhao@google.com" , "minchan@kernel.org" , Barry Song Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable X-Rspam-User: X-Stat-Signature: zorusba46mjdxirzugfg3mfeg8xniruu X-Rspamd-Queue-Id: D1F28180004 X-Rspamd-Server: rspam11 X-HE-Tag: 1726795071-443857 X-HE-Meta: U2FsdGVkX18ziOuOq42ofJ50MJ1SS052lUYCSLhJAYjYxm8ASrDK4On+I97wnl6CEoWI3q6e4B0dQsVhu1V547A2y+d/qvroP0PIqsZZrOLzx9jW2su3RBsUEfccvSBko++mvRkg5HDa/fac+KphteHaPr2gwV8QVrUsjNWgAfH87eaBvWIJ444K5T27GPurWGwK6bizxoksWQP14pi00vTMcdgr5ZVam6a2fyx6nhZRpIK1Zyzxuwjtk1tLZmo0o/KcEKGr6JCltzZJE2948j9vTncbMoh+zM1kImDhBB26fB+3ig4M924ThOFWxPS/bxIwt7bEzmeLRuBf+iU2YhxktJn12Liyb5sfgI8mCm/n0VC5z5sxEr2FOkaSE54nyBUGQtbwZlf6aq9uMXndWAVvzdDywVudDX0VyRLyc1Ng/1fXSoGXwy8U1QK+/P8yBleMgI26M9Zva4dZYcRbGFNuijSprq8sIRF0HaSSiDqhnqHCgw1lQ+PCGDSMQ5jB0TZqofb2uSNpqEcsMFw8PGXH/+Aa7/frWWhbX83b6JDlHxnEP/6mUc0UlFf+9yDrfKlwBNmV+6GF9Et/53emeWTtLtOHKXgdS2zstySO2xqQ7FKNICvQW4WP0+2AledSjroxBuHB4SDJe5yHWtrluXByMJ5vqLmTUCWaZj6XE1DeC0bLG7xbIzz8CxJXymmwdtlYexOxQm3aQM0SMob4fFGbo5jHet1qOen2pnX1bdn8h0mwfzp0LddbNYZKCal6cpfhqT2E+c5xFlb4yGbw9eQZdpcevWJz3DeDWWu4ohBVKhf+kgyvaUWzKTai0L0TDqX2xt+86grudRjZY7uaFxipJueIvCZ3WtTB/0YH2b1Qzq+4rzX1jTbtcUxIwHMHxWLuDZqTqOxVv+h+tXVl1ZUMqQP1S1yaSxNrUZpEyyrtxSpiAsYevLb7lmRY4o8ucx1+DJmMuXtvO8XzPGt eMQqzO7Z 8l9P8/y61T4RyM2DSgkz6ymFT2TumxY0BR0iW70QozNCJS0eEwXFFt40VzNscwoJrDTH2+mBKu+fMKQmvc2VN9JvNGequ+dQKz9lWYwgEGuradWipXVQCVH4Zl5GMrm0UWIuy5esGNmki+jW0VPbpZldwz/zgq3zS5PRe15igky0vCgh1eK6tTM09vyFND0IdPkPXzFLMzMfD92V8cSLFznMH+ZPncr1iTegIVUY2zWDC3ravFTwIEvv6dWbuU48GYI1BuMvKC2ZS9aoOYY5xEyiJN4nETiB17IQwqDecV9IuMeNpmAioqMPRDr8z/+UuxtkJ5L80ZITs93AtlDg4Na+jALJLr/ftjWhoBaOwuQ1IO4jcF1Nlw7xpr1S9MwzZhHAg3fnx1ebnhVGj4vnW8swZAfrqUz6kJFFuOuTy+PeQQ6aMLZUiVWE7NOZblcBaXZiLK9ww+pHtZaQpnHSU1PezDQ== X-Bogosity: Ham, tests=bogofilter, spamicity=0.000001, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: List-Subscribe: List-Unsubscribe: On Wed, Sep 18, 2024 at 6:19=E2=80=AFPM gaoxu wrote: > > > > > From: Barry Song > > > > This follows up on the discussion regarding Gaoxu's work[1]. It's > > unclear if there's still interest in implementing a separate LRU > > list for lazyfree folios, but I decided to explore it out of > > curiosity. > > > > According to Lokesh, MADV_FREE'd anon folios are expected to be > > released earlier than file folios. One option, as implemented > > by Gao Xu, is to place lazyfree anon folios at the tail of the > > file's `min_seq` generation. However, this approach results in > > lazyfree folios being released in a LIFO manner, which conflicts > > with LRU behavior, as noted by Michal. > > > > To address this, this patch proposes maintaining a separate list > > for lazyfree anon folios while keeping them classified under the > > "file" LRU type to minimize code changes. These lazyfree anon > > folios will still be counted as file folios and share the same > > generation with regular files. In the eviction path, the lazyfree > > list will be prioritized for scanning before the actual file > > LRU list. > It seems like a very feasible solution. I will conduct comparative tests > based on this patch and synchronize the test results (it will take some t= ime); > Thanks to Barry for providing the patch=EF=BC=81 Thank you, I will await your test results. > > > > [1] > > https://lore.kernel.org/linux-mm/f29f64e29c08427b95e3df30a5770056@honor > > .com/ > > > > Signed-off-by: Barry Song > > --- > > include/linux/mm_inline.h | 5 +- > > include/linux/mmzone.h | 2 +- > > mm/vmscan.c | 97 +++++++++++++++++++++++---------------- > > 3 files changed, 61 insertions(+), 43 deletions(-) > > > > diff --git a/include/linux/mm_inline.h b/include/linux/mm_inline.h > > index f4fe593c1400..118d70ed3120 100644 > > --- a/include/linux/mm_inline.h > > +++ b/include/linux/mm_inline.h > > @@ -225,6 +225,7 @@ static inline bool lru_gen_add_folio(struct lruvec > > *lruvec, struct folio *folio, > > int gen =3D folio_lru_gen(folio); > > int type =3D folio_is_file_lru(folio); > > int zone =3D folio_zonenum(folio); > > + int lazyfree =3D type ? folio_test_anon(folio) : 0; > > struct lru_gen_folio *lrugen =3D &lruvec->lrugen; > > > > VM_WARN_ON_ONCE_FOLIO(gen !=3D -1, folio); > > @@ -262,9 +263,9 @@ static inline bool lru_gen_add_folio(struct lruvec > > *lruvec, struct folio *folio, > > lru_gen_update_size(lruvec, folio, -1, gen); > > /* for folio_rotate_reclaimable() */ > > if (reclaiming) > > - list_add_tail(&folio->lru, &lrugen->folios[gen][type][zon= e]); > > + list_add_tail(&folio->lru, &lrugen->folios[gen][type + la= zyfree][zone]); > > else > > - list_add(&folio->lru, &lrugen->folios[gen][type][zone]); > > + list_add(&folio->lru, &lrugen->folios[gen][type + lazyfre= e][zone]); > > > > return true; > > } > > diff --git a/include/linux/mmzone.h b/include/linux/mmzone.h > > index 17506e4a2835..5d2331778528 100644 > > --- a/include/linux/mmzone.h > > +++ b/include/linux/mmzone.h > > @@ -434,7 +434,7 @@ struct lru_gen_folio { > > /* the birth time of each generation in jiffies */ > > unsigned long timestamps[MAX_NR_GENS]; > > /* the multi-gen LRU lists, lazily sorted on eviction */ > > - struct list_head > > folios[MAX_NR_GENS][ANON_AND_FILE][MAX_NR_ZONES]; > > + struct list_head folios[MAX_NR_GENS][ANON_AND_FILE + > > 1][MAX_NR_ZONES]; > For better understanding and future scalability, could use enum types > instead of numbers, Create a new type, such as: enum folio_type. I'd rather follow the "trick" that Yu Zhao has been using such as int type =3D folio_is_file_lru(folio); while I agree providing two macros as below #define LRU_TYPE_ANON 0 #define LRU_TYPE_FILE 1 might improve the readability by things like: int list_num =3D (type =3D=3D LRU_TYPE_FILE) ? 2 : 1; However, considering the code in a larger context, since type =3D folio_is_file_lru(folio), doesn't that imply that type is already set to file? Therefore, the compari= son type =3D=3D LRU_TYPE_FILE seems redundant. So, if we want to continue using this approach, it seems that there=E2=80= =99s nothing worth changing? > > /* the multi-gen LRU sizes, eventually consistent */ > > long nr_pages[MAX_NR_GENS][ANON_AND_FILE][MAX_NR_ZONES]; > > /* the exponential moving average of refaulted */ > > diff --git a/mm/vmscan.c b/mm/vmscan.c > > index 96abf4a52382..9dc665dc6ba9 100644 > > --- a/mm/vmscan.c > > +++ b/mm/vmscan.c > > @@ -3725,21 +3725,25 @@ static bool inc_min_seq(struct lruvec *lruvec, = int > > type, bool can_swap) > > > > /* prevent cold/hot inversion if force_scan is true */ > > for (zone =3D 0; zone < MAX_NR_ZONES; zone++) { > > - struct list_head *head =3D &lrugen->folios[old_gen][type]= [zone]; > > + int list_num =3D type ? 2 : 1; > > + struct list_head *head; > > > > - while (!list_empty(head)) { > > - struct folio *folio =3D lru_to_folio(head); > > + for (int i =3D list_num - 1; i >=3D 0; i--) { > > + head =3D &lrugen->folios[old_gen][type + i][zone]= ; > > + while (!list_empty(head)) { > > + struct folio *folio =3D lru_to_folio(head= ); > > > > - VM_WARN_ON_ONCE_FOLIO(folio_test_unevictable(foli= o), > > folio); > > - VM_WARN_ON_ONCE_FOLIO(folio_test_active(folio), f= olio); > > - VM_WARN_ON_ONCE_FOLIO(folio_is_file_lru(folio) != =3D type, > > folio); > > - VM_WARN_ON_ONCE_FOLIO(folio_zonenum(folio) !=3D z= one, > > folio); > > + VM_WARN_ON_ONCE_FOLIO(folio_test_unevicta= ble(folio), > > folio); > > + VM_WARN_ON_ONCE_FOLIO(folio_test_active(f= olio), folio); > > + VM_WARN_ON_ONCE_FOLIO(folio_is_file_lru(f= olio) !=3D type, > > folio); > > + VM_WARN_ON_ONCE_FOLIO(folio_zonenum(folio= ) !=3D zone, > > folio); > > > > - new_gen =3D folio_inc_gen(lruvec, folio, false); > > - list_move_tail(&folio->lru, > > &lrugen->folios[new_gen][type][zone]); > > + new_gen =3D folio_inc_gen(lruvec, folio, = false); > > + list_move_tail(&folio->lru, &lrugen->foli= os[new_gen][type + > > i][zone]); > > > > - if (!--remaining) > > - return false; > > + if (!--remaining) > > + return false; > > + } > > } > > } > > done: > > @@ -4291,6 +4295,7 @@ static bool sort_folio(struct lruvec *lruvec, str= uct folio > > *folio, struct scan_c > > int refs =3D folio_lru_refs(folio); > > int tier =3D lru_tier_from_refs(refs); > > struct lru_gen_folio *lrugen =3D &lruvec->lrugen; > > + int lazyfree =3D type ? folio_test_anon(folio) : 0; > > > > VM_WARN_ON_ONCE_FOLIO(gen >=3D MAX_NR_GENS, folio); > > > > @@ -4306,7 +4311,7 @@ static bool sort_folio(struct lruvec *lruvec, str= uct folio > > *folio, struct scan_c > > > > /* promoted */ > > if (gen !=3D lru_gen_from_seq(lrugen->min_seq[type])) { > > - list_move(&folio->lru, &lrugen->folios[gen][type][zone]); > > + list_move(&folio->lru, &lrugen->folios[gen][type + lazyfr= ee][zone]); > > return true; > > } > > > > @@ -4315,7 +4320,7 @@ static bool sort_folio(struct lruvec *lruvec, str= uct folio > > *folio, struct scan_c > > int hist =3D lru_hist_from_seq(lrugen->min_seq[type]); > > > > gen =3D folio_inc_gen(lruvec, folio, false); > > - list_move_tail(&folio->lru, &lrugen->folios[gen][type][zo= ne]); > > + list_move_tail(&folio->lru, &lrugen->folios[gen][type + > > lazyfree][zone]); > > > > WRITE_ONCE(lrugen->protected[hist][type][tier - 1], > > lrugen->protected[hist][type][tier - 1] + delt= a); > > @@ -4325,7 +4330,7 @@ static bool sort_folio(struct lruvec *lruvec, str= uct folio > > *folio, struct scan_c > > /* ineligible */ > > if (!folio_test_lru(folio) || zone > sc->reclaim_idx) { > > gen =3D folio_inc_gen(lruvec, folio, false); > > - list_move_tail(&folio->lru, &lrugen->folios[gen][type][zo= ne]); > > + list_move_tail(&folio->lru, &lrugen->folios[gen][type + > > lazyfree][zone]); > > return true; > > } > > > > @@ -4333,7 +4338,7 @@ static bool sort_folio(struct lruvec *lruvec, str= uct folio > > *folio, struct scan_c > > if (folio_test_locked(folio) || folio_test_writeback(folio) || > > (type =3D=3D LRU_GEN_FILE && folio_test_dirty(folio))) { > > gen =3D folio_inc_gen(lruvec, folio, true); > > - list_move(&folio->lru, &lrugen->folios[gen][type][zone]); > > + list_move(&folio->lru, &lrugen->folios[gen][type + lazyfr= ee][zone]); > > return true; > > } > > > > @@ -4377,7 +4382,7 @@ static bool isolate_folio(struct lruvec *lruvec, = struct > > folio *folio, struct sca > > static int scan_folios(struct lruvec *lruvec, struct scan_control *sc, > > int type, int tier, struct list_head *list) > > { > > - int i; > > + int i, j; > > int gen; > > enum vm_event_item item; > > int sorted =3D 0; > > @@ -4399,33 +4404,38 @@ static int scan_folios(struct lruvec *lruvec, s= truct > > scan_control *sc, > > LIST_HEAD(moved); > > int skipped_zone =3D 0; > > int zone =3D (sc->reclaim_idx + i) % MAX_NR_ZONES; > > - struct list_head *head =3D &lrugen->folios[gen][type][zon= e]; > > - > > - while (!list_empty(head)) { > > - struct folio *folio =3D lru_to_folio(head); > > - int delta =3D folio_nr_pages(folio); > > - > > - VM_WARN_ON_ONCE_FOLIO(folio_test_unevictable(foli= o), > > folio); > > - VM_WARN_ON_ONCE_FOLIO(folio_test_active(folio), f= olio); > > - VM_WARN_ON_ONCE_FOLIO(folio_is_file_lru(folio) != =3D type, > > folio); > > - VM_WARN_ON_ONCE_FOLIO(folio_zonenum(folio) !=3D z= one, > > folio); > > - > > - scanned +=3D delta; > > + int list_num =3D type ? 2 : 1; > > + struct list_head *head; > > + > > + for (j =3D list_num - 1; j >=3D 0; j--) { > > + head =3D &lrugen->folios[gen][type + j][zone]; > > + while (!list_empty(head)) { > > + struct folio *folio =3D lru_to_folio(head= ); > > + int delta =3D folio_nr_pages(folio); > > + > > + VM_WARN_ON_ONCE_FOLIO(folio_test_unevicta= ble(folio), > > folio); > > + VM_WARN_ON_ONCE_FOLIO(folio_test_active(f= olio), folio); > > + VM_WARN_ON_ONCE_FOLIO(folio_is_file_lru(f= olio) !=3D type, > > folio); > > + VM_WARN_ON_ONCE_FOLIO(folio_zonenum(folio= ) !=3D zone, > > folio); > > + > > + scanned +=3D delta; > > + > > + if (sort_folio(lruvec, folio, sc, tier)) > > + sorted +=3D delta; > > + else if (isolate_folio(lruvec, folio, sc)= ) { > > + list_add(&folio->lru, list); > > + isolated +=3D delta; > > + } else { > > + list_move(&folio->lru, &moved); > > + skipped_zone +=3D delta; > > + } > > > > - if (sort_folio(lruvec, folio, sc, tier)) > > - sorted +=3D delta; > > - else if (isolate_folio(lruvec, folio, sc)) { > > - list_add(&folio->lru, list); > > - isolated +=3D delta; > > - } else { > > - list_move(&folio->lru, &moved); > > - skipped_zone +=3D delta; > > + if (!--remaining || max(isolated, skipped= _zone) >=3D > > MIN_LRU_BATCH) > > + goto isolate_done; > > } > > - > > - if (!--remaining || max(isolated, skipped_zone) >= =3D > > MIN_LRU_BATCH) > > - break; > > } > > > > +isolate_done: > > if (skipped_zone) { > > list_splice(&moved, head); > > __count_zid_vm_events(PGSCAN_SKIP, zone, skipped_= zone); > > @@ -5586,8 +5596,15 @@ void lru_gen_init_lruvec(struct lruvec *lruvec) > > for (i =3D 0; i <=3D MIN_NR_GENS + 1; i++) > > lrugen->timestamps[i] =3D jiffies; > > > > - for_each_gen_type_zone(gen, type, zone) > > + for_each_gen_type_zone(gen, type, zone) { > > INIT_LIST_HEAD(&lrugen->folios[gen][type][zone]); > > + /* > > + * lazyfree anon folios have a separate list while using > > + * file as type > > + */ > > + if (type) > > + INIT_LIST_HEAD(&lrugen->folios[gen][type + 1][zon= e]); > > + } > > > > if (mm_state) > > mm_state->seq =3D MIN_NR_GENS; > > -- > > 2.39.3 (Apple Git-146) > Thanks Barry