Received: by 2002:a05:6a10:5bc5:0:0:0:0 with SMTP id os5csp2617336pxb; Sun, 17 Oct 2021 20:38:53 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyFoLkKCP7iIuXmSWh1rKyPI/ASETPzhsbhHL7UQQxaSdDVlN0yimCOb6+I3GG51VMg44/j X-Received: by 2002:a17:902:ab0e:b0:13f:37ae:9582 with SMTP id ik14-20020a170902ab0e00b0013f37ae9582mr25121652plb.82.1634528333445; Sun, 17 Oct 2021 20:38:53 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1634528333; cv=none; d=google.com; s=arc-20160816; b=cm9PEGu+ji07xrX6AsinCtBcs5tQfLKHoDORVz5E9wvX10BpR05k4eYU25Ym3/P5+X QtejjgCsJPKLbLBvn4xNM/nS/vCaOaSIt21rsESvUh8YyLQloXVzE2022lNd5PcHQ+Rl hlAYAOxZ3BDZd2ms4UPxBG5w5J+G4ZiSltQzwEXKZusSPLtW3HY9prhZCDZvB48CyqB4 qOMfeYnvOE9UKSX1y/GdgtPhRkiH7tntsDIxJEBBEU/DuCY5pPgIbAWVsLQzqUeK7MIe hsvgk+EPxKWHCPyyChZJmyGIcsbdnLVtrikWWpgMlifWnsCnKjEizGb36pLUg4ozK4hQ 3s6w== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-disposition:mime-version :references:message-id:subject:cc:to:from:date:dkim-signature; bh=YhoZ9iqL7Lt/48xizN3kGQkUKxxKpNWaP56fG+nsLtw=; b=wuHyYRCqe7d5T/r1NOql322P4+8pxzpWK3s6YAMCW3g7xLPzjdJ2LQt87dXI0uF6mx gRzX0zJf0IAmUy7w/ckzHiCf4sEh23nV26Di0+PPTXPJ99xkd6glX30VxsiU1VMEZahC tWgKss/wsEFmqkWqJxiFgdIfW2uRh4oq0m/I0voWKPeEpJHz3GfdHD6YdvRLEWBTbXd9 4isgKwf2JOzE99MiTKQ/LisI9eCOVzxmep1PTfNWgmdWAFyLhMjf0UvHoDQOxkqRAacN AFQfAkIoNX6YwydvAPU+q3Xv/zBOsGmELCQ+EtGFEgSZ8vXlBUArnQmFHMlq7uOgaZub XRwQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@infradead.org header.s=casper.20170209 header.b=BTa3EpFZ; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id h1si6131155pfn.378.2021.10.17.20.38.41; Sun, 17 Oct 2021 20:38:53 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@infradead.org header.s=casper.20170209 header.b=BTa3EpFZ; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S240868AbhJPTKY (ORCPT + 98 others); Sat, 16 Oct 2021 15:10:24 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:40754 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234126AbhJPTKX (ORCPT ); Sat, 16 Oct 2021 15:10:23 -0400 Received: from casper.infradead.org (casper.infradead.org [IPv6:2001:8b0:10b:1236::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 34BDFC061765; Sat, 16 Oct 2021 12:08:15 -0700 (PDT) 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=YhoZ9iqL7Lt/48xizN3kGQkUKxxKpNWaP56fG+nsLtw=; b=BTa3EpFZlDI9sQ/CGo27JdqpF1 zea4OMDz9wdbs9X9mVE4QLL98dKW7zwqVGoola+MsuQ6loexIWIr2vwszhQ+xXMepJafgIofVC4Wm XU9hch2D/PZigjKg/5WZmPn1fJXzgN3wPihZU7PTjKmRftbP05X3VJnq5KIP+1g7+O7Dtw/Tt7vjO bZX4kB4UNeDTt9sVG8/5YH33YZjCIiiTaQbDc8C5xYNKjac+cbe4uvkJ/tPQDLuFPCA6pm5ICEHmN X4hzdX17Q0a/TE87F4fdVRaaSv+xHD7as2g/wqDmzw01C3K/TlwPT9IKivuouEeTn9y/ljEnln2RI WQbXp/Jg==; Received: from willy by casper.infradead.org with local (Exim 4.94.2 #2 (Red Hat Linux)) id 1mbp1w-009qFq-NC; Sat, 16 Oct 2021 19:07:46 +0000 Date: Sat, 16 Oct 2021 20:07:40 +0100 From: Matthew Wilcox To: Johannes Weiner Cc: Kent Overstreet , Linus Torvalds , linux-mm@kvack.org, linux-fsdevel@vger.kernel.org, linux-kernel@vger.kernel.org, Andrew Morton , "Darrick J. Wong" , Christoph Hellwig , David Howells Subject: Re: Folios for 5.15 request - Was: re: Folio discussion recap - Message-ID: References: MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Wed, Sep 22, 2021 at 11:08:58AM -0400, Johannes Weiner wrote: > mm/lru: Add folio LRU functions > > The LRU code is used by anon and file and not needed > for the filesystem API. > > And as discussed, there is generally no ambiguity of > tail pages on the LRU list. One of the assumptions you're making is that the current code is suitable for folios. One of the things that happens in this patch is: - update_lru_size(lruvec, lru, page_zonenum(page), thp_nr_pages(page)); + update_lru_size(lruvec, lru, folio_zonenum(folio), + folio_nr_pages(folio)); static inline long folio_nr_pages(struct folio *folio) { return compound_nr(&folio->page); } vs #ifdef CONFIG_TRANSPARENT_HUGEPAGE static inline int thp_nr_pages(struct page *page) { VM_BUG_ON_PGFLAGS(PageTail(page), page); if (PageHead(page)) return HPAGE_PMD_NR; return 1; } #else static inline int thp_nr_pages(struct page *page) { VM_BUG_ON_PGFLAGS(PageTail(page), page); return 1; } #endif So if you want to leave all the LRU code using pages, all the uses of thp_nr_pages() need to be converted to compound_nr(). Or maybe not all of them; I don't know which ones might be safe to leave as thp_nr_pages(). That's one of the reasons I went with a whitelist approach.