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 mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 9672EC433F5 for ; Sat, 16 Oct 2021 19:08:13 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id E22EB61152 for ; Sat, 16 Oct 2021 19:08:12 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.1 mail.kernel.org E22EB61152 Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=infradead.org Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=kvack.org Received: by kanga.kvack.org (Postfix) id 5E252900002; Sat, 16 Oct 2021 15:08:12 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 56B6A6B0072; Sat, 16 Oct 2021 15:08:12 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 459A9900002; Sat, 16 Oct 2021 15:08:12 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0234.hostedemail.com [216.40.44.234]) by kanga.kvack.org (Postfix) with ESMTP id 32DDD6B0071 for ; Sat, 16 Oct 2021 15:08:12 -0400 (EDT) Received: from smtpin20.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay05.hostedemail.com (Postfix) with ESMTP id C366F1802610F for ; Sat, 16 Oct 2021 19:08:11 +0000 (UTC) X-FDA: 78703235982.20.8740A0E Received: from casper.infradead.org (casper.infradead.org [90.155.50.34]) by imf21.hostedemail.com (Postfix) with ESMTP id 5AB92D0399BA for ; Sat, 16 Oct 2021 19:08:09 +0000 (UTC) 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: X-Rspamd-Queue-Id: 5AB92D0399BA X-Stat-Signature: bcs6ec8qmq8c4kapnxruzbf8d7sk39s6 Authentication-Results: imf21.hostedemail.com; dkim=pass header.d=infradead.org header.s=casper.20170209 header.b=BTa3EpFZ; dmarc=none; spf=none (imf21.hostedemail.com: domain of willy@infradead.org has no SPF policy when checking 90.155.50.34) smtp.mailfrom=willy@infradead.org X-Rspamd-Server: rspam02 X-HE-Tag: 1634411289-946129 X-Bogosity: Ham, tests=bogofilter, spamicity=0.000000, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: 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.