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 X-Spam-Level: X-Spam-Status: No, score=-3.5 required=3.0 tests=BAYES_00,DKIM_INVALID, DKIM_SIGNED,HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,SPF_HELO_NONE, SPF_PASS autolearn=no autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 9F01CC433B4 for ; Sat, 15 May 2021 15:51:57 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id 0FA6661042 for ; Sat, 15 May 2021 15:51:56 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 0FA6661042 Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=infradead.org Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=owner-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix) id 2023A8E0002; Sat, 15 May 2021 11:51:56 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 18B9A8D0001; Sat, 15 May 2021 11:51:56 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 004EE8E0002; Sat, 15 May 2021 11:51:55 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0245.hostedemail.com [216.40.44.245]) by kanga.kvack.org (Postfix) with ESMTP id BE95F8D0001 for ; Sat, 15 May 2021 11:51:55 -0400 (EDT) Received: from smtpin11.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay04.hostedemail.com (Postfix) with ESMTP id 5AD7A814A for ; Sat, 15 May 2021 15:51:55 +0000 (UTC) X-FDA: 78143906190.11.7EDE9F1 Received: from casper.infradead.org (casper.infradead.org [90.155.50.34]) by imf02.hostedemail.com (Postfix) with ESMTP id 47CB340002DC for ; Sat, 15 May 2021 15:51:53 +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=IaWx73PoXKzw/QNbHeKdp9HvTY0/GoR4xc8LobmdnCc=; b=GhRi4lJHdfK6UCyrz8P5P7Vg7x L4emzVRzmleOj5EksAxcn5Hqd2HjLrNz0BDRjQxzk6q48DfVORoETkcy7yM7271JvxfO2hcbGp/eq yhh704cJ1DLbmxd46u+TLpvjbpaoARCiD1WgG5SL1H/PHsRARoF2jn5GBnLwusIHU4kyAeqF/P6UY xYR08XU7P6u9C5+5b5EWX5nyR834e8aQkTi+/3Jy3GDo/msiDNVZsOE2kMM8UOu+Je2wNVw8c9UOB nBKj1xRBxifK8X1G6Rd/vEp+XP3o70S+QAnadbht+cXtnQY6rmoSSy0CyO7L8PJ0+sBPR/41Vo+Sx LttRK2bg==; Received: from willy by casper.infradead.org with local (Exim 4.94 #2 (Red Hat Linux)) id 1lhwZm-00BLCZ-R7; Sat, 15 May 2021 15:51:41 +0000 Date: Sat, 15 May 2021 16:51:38 +0100 From: Matthew Wilcox To: Vlastimil Babka Cc: akpm@linux-foundation.org, linux-fsdevel@vger.kernel.org, linux-mm@kvack.org, linux-kernel@vger.kernel.org, Christoph Hellwig , Jeff Layton Subject: Re: [PATCH v10 12/33] mm/filemap: Add folio_index, folio_file_page and folio_contains Message-ID: References: <20210511214735.1836149-1-willy@infradead.org> <20210511214735.1836149-13-willy@infradead.org> <77357d4f-5f56-6c12-7602-697773c2f125@suse.cz> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <77357d4f-5f56-6c12-7602-697773c2f125@suse.cz> X-Rspamd-Queue-Id: 47CB340002DC Authentication-Results: imf02.hostedemail.com; dkim=pass header.d=infradead.org header.s=casper.20170209 header.b=GhRi4lJH; dmarc=none; spf=none (imf02.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: rspam03 X-Stat-Signature: njbfzwjewwpmtwjhrfk37hcquxoozd8b X-HE-Tag: 1621093913-222303 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 Fri, May 14, 2021 at 05:55:46PM +0200, Vlastimil Babka wrote: > On 5/11/21 11:47 PM, Matthew Wilcox (Oracle) wrote: > > folio_index() is the equivalent of page_index() for folios. > > folio_file_page() is the equivalent of find_subpage(). > > find_subpage() special cases hugetlbfs, folio_file_page() doesn't. > > > folio_contains() is the equivalent of thp_contains(). > > Yet here, both thp_contains() and folio_contains() does. > > This patch doesn't add users so maybe it becomes obvious later, but perhaps > worth explaining in the changelog or comment? No, you're right, this is a bug. I originally had it in my mind that hugetlbfs wouldn't need to do this any more because it can just use the folio interfaces and never try to find the subpage. But I don't understand all the cases well enough to be sure that they're all gone, and they certainly don't all go as part of this patch series. So I think I need to reintroduce the check-for-hugetlb to folio_file_page() and we can look at removing it later once we're sure that nobody is using the interfaces that return pages from the page cache any more. Or we convert hugetlbfs to use the page cache the same way as every other filesystem ;-) Thanks for spotting that.