From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from casper.infradead.org (casper.infradead.org [90.155.50.34]) (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 C49D72416B4 for ; Wed, 15 Jan 2025 13:25:39 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=90.155.50.34 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1736947541; cv=none; b=YN12yFKxo6defOYL22ro5u2ctOJ/av8oE8R4ciKMYOSf32oxcbURSe2kaVgtojnUMJjGqqOr0uay6uDdDHKTDfHybDXYuub4x/I2dOaCJo3vqI4x4GZPNNPgvD2KyL4OhH3SLgKrJMTzraqcF2TECCfQCI438Yw3vDChI08e/sg= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1736947541; c=relaxed/simple; bh=FzuTVXnijTSAl9LIQUYXZ0WEQOT7jH6QjsQ97CapvaQ=; h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version: Content-Type:Content-Disposition:In-Reply-To; b=VEq7w9jNCRv1XEsNaBweiYmhB67dqU2P6NnKoPuwGU109vSfJBMirq7JZ1GFKM8LPfHDoD2kT3JC4hErZjdjcWS6g9cznNS5mWBunHAK8Ac2aK/aVN4OPJVdQyamJXJcI4NXlj+7oybemk0ghhs/E9gHJJsPzbxJWyxvDf+DSLg= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=infradead.org; spf=none smtp.mailfrom=infradead.org; dkim=pass (2048-bit key) header.d=infradead.org header.i=@infradead.org header.b=CuejnQPk; arc=none smtp.client-ip=90.155.50.34 Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=infradead.org Authentication-Results: smtp.subspace.kernel.org; spf=none smtp.mailfrom=infradead.org Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=infradead.org header.i=@infradead.org header.b="CuejnQPk" DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=casper.20170209; h=In-Reply-To:Content-Type:MIME-Version: References:Message-ID:Subject:Cc:To:From:Date:Sender:Reply-To: Content-Transfer-Encoding:Content-ID:Content-Description; bh=7tqHsk32GRVJTPeir0cQQtTbXibFwL/D4IJQVM2F+Ag=; b=CuejnQPkBCxpD2n5BHFW0Wqi9T Baj6MJJpjf+Ez7KvwUD5chJZJrrK/DYcR1rF14aVvETwE5o6fawbl/P3t/pTfDENqXbmm/i1KLX2+ lvmxar/x2TN5gPR6epLPhQ3En2YaPDvekBXVM9TQ3NYd9N8gYhIfr4w4dew3dG5G+ANC/HoBsOBxK FG1M64QrKHOXNabZ5lj5L/Eof0AzB4sitHgzaHuFnpRunOU0L6+BsbqWFd54ROpI+AsiIGltrviZ9 T58MgZEUTEw2ZvbKiVQ5hm7ZFX6dxOoLfO02XafLM0tp56n6Zhhli9je/xonfb5EaPrUF8CfWCnbk adAIyQGw==; Received: from willy by casper.infradead.org with local (Exim 4.98 #2 (Red Hat Linux)) id 1tY3Oo-0000000DrFJ-05jb; Wed, 15 Jan 2025 13:25:34 +0000 Date: Wed, 15 Jan 2025 13:25:33 +0000 From: Matthew Wilcox To: Donet Tom Cc: Andrew Morton , linux-mm@kvack.org, linux-kernel@vger.kernel.org, Gregory Price , Yu Zhao , Ritesh Harjani , "Aneesh Kumar K . V" , David Hildenbrand , Huang Ying , Johannes Weiner Subject: Re: [RFC] mm/swap.c: Enable promotion of unmapped MGLRU page cache pages Message-ID: References: <20250115120625.3785-1-donettom@linux.ibm.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: <20250115120625.3785-1-donettom@linux.ibm.com> On Wed, Jan 15, 2025 at 06:06:25AM -0600, Donet Tom wrote: > An MGLRU page cache page is eligible for promotion when: > > 1. Memory Tiering and pagecache_promotion_enabled are enabled > 2. It resides in a lower memory tier. > 3. It is referenced. > 4. It is part of the working set. > 5. It belongs to the active list. > For MGLRU, the youngest generation and the youngest generation - 1 > are treated as the active list. ... why do you only promote folios if they belong to a memcg? > +promo_candid: > + if (!folio_test_isolated(folio) && > + (sysctl_numa_balancing_mode & NUMA_BALANCING_MEMORY_TIERING) && > + numa_pagecache_promotion_enabled) { > + memcg = folio_memcg(folio); > + if (memcg) { > + lruvec = mem_cgroup_lruvec(memcg, folio_pgdat(folio)); > + gen = folio_lru_gen(folio); > + > + if ((gen < MAX_NR_GENS) && lru_gen_is_active(lruvec, gen)) > + promotion_candidate(folio); > + } Should there be an 'else' clause here? Or should it be: lruvec = mem_cgroup_lruvec(memcg, folio_pgdat(folio)); gen = folio_lru_gen(folio); if ((gen < MAX_NR_GENS) && lru_gen_is_active(lruvec, gen)) promotion_candidate(folio);