From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mail-qt1-f181.google.com (mail-qt1-f181.google.com [209.85.160.181]) (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 D1E8327A92D for ; Tue, 4 Aug 2026 01:21:39 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.160.181 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1785806503; cv=none; b=ldFOdj2SQ2t9s0dxRLk3/khFWX1FAoCHCFqKav+0suIwqQLj07vGh/BuVuW82ZvTf/QR0UBSoQIS/U88wdVfmRLmDHY2+dNc/W7nBq1psv/2+I5wYfOj26F9VBV5KNvwLiSZskVWQ2CunBmHHIl8IyBJqMSq2ToO4PXo4ocgwHI= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1785806503; c=relaxed/simple; bh=MR3AHJCTMuN/Cx4YUzod4EVODKq4RZJrK+vAu8CMS30=; h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version: Content-Type:Content-Disposition:In-Reply-To; b=CeX/e1y6Uc7c3bP39V/dO+mPEnGAjGYPFtOS+hAg0pZxo3Sc6GIVm640qFXbp6mpZ5azVp4V+J4dsmJ/Y2AerW2m34kULXOR99MG67T7JteknPFDLGUSwOPpfQ0+VH+p/FL4v77/C7maX2WpB1NaYOjDhRIV7dGBLY8FS0N5JT4= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=cmpxchg.org; spf=pass smtp.mailfrom=cmpxchg.org; dkim=pass (2048-bit key) header.d=cmpxchg.org header.i=@cmpxchg.org header.b=tCf19/Ls; arc=none smtp.client-ip=209.85.160.181 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=cmpxchg.org Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=cmpxchg.org Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=cmpxchg.org header.i=@cmpxchg.org header.b="tCf19/Ls" Received: by mail-qt1-f181.google.com with SMTP id d75a77b69052e-529a1ee0e62so21963051cf.2 for ; Mon, 03 Aug 2026 18:21:39 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=cmpxchg.org; s=google; t=1785806498; x=1786411298; darn=vger.kernel.org; h=in-reply-to:content-disposition:content-type:mime-version :references:message-id:subject:cc:to:from:date:from:to:cc:subject :date:message-id:reply-to:content-type; bh=AguyGUwr4ziCw0A1INIvfSK+5JRD4S5eHUYfwjfXhZE=; b=tCf19/LsxdcDZGxq2f/q9FocFOTBaGDUGdUN9Q677ab/kT00QL+ImYAOtGlArotfhf ccYN+ynCmSjICFz3lPPWpkVbegT/yTe/3bOcRda20yQFyulGmLBEVWixBGzKsRNjWYKC OFQ+lG8XY1x5QHRRe32JqD50JJc8t+llCDymYc8wSdwutTksWurwbNJ9tSwnh2LvC+Z5 fGH+SnsgZABFVACCdGERDdQboPrLo65s1vhwQnGAh0rk6f2hzJcT/HUXhzt5dD5lMbG0 WK+MZu1Z8yrSRI5fGG9Mq2864JnMzajeWBPUX51kQSsd6J/156KbpdDwbJMO7xGA/45z VY+w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1785806498; x=1786411298; h=in-reply-to:content-disposition:content-type:mime-version :references:message-id:subject:cc:to:from:date:x-gm-gg :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to :content-type; bh=AguyGUwr4ziCw0A1INIvfSK+5JRD4S5eHUYfwjfXhZE=; b=sTf/vSoPxYO6hKA8yCyNhFrD6BBUcHEkEFgCio/XrOJMGiCTgtNSi9by/6HxCpmvCq NWDfFqpOEgIUMAbxqZre97uAc6gI1kq1VQ7zN6/tGRRFXEVnlv4B1uIhhfRtVwC+LYZV PVyXSJpR7dasX1xD6cHgAuy7xkubJH8NxmwD44LPSk9huH37iiXSadZUTGEyOh8GMRVo mDVcJYaSZtcbiN0ashsYTIYOQTt27GIabOza2p7nrpwlql0npMZqgazkqUbpe7UgaV2R IYFsY4RfV79BJ82Ooof/4OG8QyLEDjDJEbcAHjYx0OhYAoF7sYi6raLnu7ycQ3Q2Cne+ OxTw== X-Forwarded-Encrypted: i=1; AHgh+Rr1kf2X2WrxGqTTlMLeaplhtKtspfvscnG8fQeUHZND3vXNe49nFuLVXolu748C/fBb3/BPmqwf8N6K01Q=@vger.kernel.org X-Gm-Message-State: AOJu0Yy5XvdzNfXPAe5dNLOmpOXxcQBuyriCKfHy61qCJQIMWXxIwOkX G5UGSwJEdnMvKtqt4iPBboNFMOpGkNkRaBJzvxwnKfpzT3ULQEaKELizS4ST88u9Mxo= X-Gm-Gg: AR+sD13JeSRZgkZ3cX8sQZgdBx/g0u0rxLSlc9ltXyL9fd8DlYwXw1SG/K7jJMPKdpO 5RaInYPySxMd6yXWH3/RfSBb9xd+mXwADE9dZPyqEkpfUhJlxtU++3Q/XM6HVTAPQr+jOzM98wz dJEPLnov4flyyrBowOu7Kgbqzz+G7XXGKKV/2ZNb0AsXFJL9oUhFJd82RkGdr7fml/9VvJ1223S x6/nVAx0rP+1CB0FkVoN68IZXC5J5GT/0XjNcdEX1cRP2OY2MwxZQKhPYNIshSgdLKfMeM9sN/5 FLLUWP2Gg66yzJ7ZDPEpFFnoa8wgurccyEM6S2VrpHwN5GN3Z3EBHjrSRJonjAa1/yQtQK9gMnQ UJIb1Pgfy8QTJf9PlvL0Zg+dJ0tClBe1RiAtkdxuZDuHOjkKJ9ym6RSB8Wpo5l9r5S1FD3OeBgW c8XgDp7pc3kOXUgVplDkgUBNelZ+RDILeRlKPBj7si3EsMsuQ9TCYHCAVcSsU= X-Received: by 2002:a05:622a:480b:b0:516:dbf6:f8e7 with SMTP id d75a77b69052e-52b56738372mr234910771cf.17.1785806498544; Mon, 03 Aug 2026 18:21:38 -0700 (PDT) Received: from localhost ([2603:7001:f100:500:365a:60ff:fe62:ff29]) by smtp.gmail.com with ESMTPSA id d75a77b69052e-52b4eb96ad0sm72483551cf.23.2026.08.03.18.21.37 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 03 Aug 2026 18:21:37 -0700 (PDT) Date: Mon, 3 Aug 2026 21:21:33 -0400 From: Johannes Weiner To: kasong@tencent.com Cc: linux-mm@kvack.org, Andrew Morton , Muchun Song , Qi Zheng , Ying Huang , Chris Li , Baoquan He , Nico Pache , Usama Arif , Michal Hocko , Roman Gushchin , Shakeel Butt , David Hildenbrand , Lorenzo Stoakes , Barry Song , Axel Rasmussen , Yuanchu Xie , Wei Xu , Vlastimil Babka , Suren Baghdasaryan , Kemeng Shi , Nhat Pham , Youngjun Park , Zi Yan , Gregory Price , "Matthew Wilcox (Oracle)" , Baolin Wang , Ryan Roberts , Dev Jain , Lance Yang , Hugh Dickins , SeongJae Park , David Rientjes , Yu Zhao , Vernon Yang , Zicheng Wang , Chen Ridong , Tal Zussman , Kairui Song , linux-kernel@vger.kernel.org, cgroups@vger.kernel.org Subject: Re: [PATCH RFC 12/15] mm/smap: report workingset folios as referenced Message-ID: References: <20260804-mglru-fg-v1-0-4d8dad39dad6@tencent.com> <20260804-mglru-fg-v1-12-4d8dad39dad6@tencent.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 Content-Disposition: inline In-Reply-To: <20260804-mglru-fg-v1-12-4d8dad39dad6@tencent.com> On Tue, Aug 04, 2026 at 03:47:08AM +0800, Kairui Song via B4 Relay wrote: > @@ -944,6 +944,22 @@ static void smaps_page_accumulate(struct mem_size_stats *mss, > } > } > > +static bool smap_check_folio_referenced(struct folio *folio) > +{ > + if (lru_gen_enabled()) > + return folio_is_referenced(folio); > + else > + return folio_is_referenced_by_bit(folio); > +} > + > +static void smap_clear_folio_referenced(struct folio *folio) > +{ > + if (lru_gen_enabled()) > + folio_set_lru_refs(folio, 0); > + else > + folio_clear_referenced_by_bit(folio); > +} I don't really understand this and the preceding 2 patches. What is the benefit of a "shared" ref/workingset state implementation when you then still have separate APIs for querying & modifying? Switching some these callers from folio_test_workingset() to folio_is_workingset()? But both functions continue to exist? Why not make versions of folio_test_workingset(), folio_test_referenced(), folio_clear_referenced() etc. that do the arbitration (bit ops on classic, refs ops on mglru) and leave callers that are only interested in boolean states, like here, alone? folio_test_anon(), folio_test_lazyfree(), folio_test_swapcache() - there are many examples where they don't just test a raw bit but assess more complex, composed state.