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 kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by smtp.lore.kernel.org (Postfix) with ESMTP id D558EC433F5 for ; Fri, 6 May 2022 01:39:20 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id E91846B0071; Thu, 5 May 2022 21:39:19 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id E41306B0073; Thu, 5 May 2022 21:39:19 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id D0ABF6B0074; Thu, 5 May 2022 21:39:19 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0012.hostedemail.com [216.40.44.12]) by kanga.kvack.org (Postfix) with ESMTP id C117C6B0071 for ; Thu, 5 May 2022 21:39:19 -0400 (EDT) Received: from smtpin23.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay11.hostedemail.com (Postfix) with ESMTP id 97D34807C7 for ; Fri, 6 May 2022 01:39:19 +0000 (UTC) X-FDA: 79433610438.23.2B4B1AA Received: from casper.infradead.org (casper.infradead.org [90.155.50.34]) by imf25.hostedemail.com (Postfix) with ESMTP id 6656FA0093 for ; Fri, 6 May 2022 01:39:04 +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=RUCuh0Yr1Y6JTXnCuBZZuiC7+M30b9WdU4d2a8UlRbA=; b=vWg5OplV557kF8enqEwbtYVKRF 5HB/j8WMz0fPPU1wu5z2Mp14K5kWXhtV1gXezS2EUzsy0fzFdWMsWEqK4lA0L+zXZxb7Qvlz57u0F ci067AFZl+IxlLWVTR9W/4ukCjmDxJp9pUvjPBkmxh5QpHKI7d3JG8Q1NFea1Et9uIsDnsHE73rya c456++MewSzxtG1AQd4JAydAs9wpClmKYiQTed8aECvlb+ym4zOkgIMDUJel3z8pFyGdRwsP5xPnI u4XzftbC2cuIP+jSeiQ23PoriEy6NI+fE7XEfyFVCeDZobtIhwDBvXayUnV9UErYb7s6TBDTxA7zz dEtB2zDA==; Received: from willy by casper.infradead.org with local (Exim 4.94.2 #2 (Red Hat Linux)) id 1nmmw4-000Vq5-Bj; Fri, 06 May 2022 01:39:12 +0000 Date: Fri, 6 May 2022 02:39:12 +0100 From: Matthew Wilcox To: Andrew Morton Cc: akpm@linuxfoundation.org, linux-mm@kvack.org, Neil Brown Subject: Re: [PATCH v2 08/26] swap: Convert add_to_swap() to take a folio Message-ID: References: <20220504182857.4013401-1-willy@infradead.org> <20220504182857.4013401-9-willy@infradead.org> <20220505182136.e003eb59f846bb7839be4f6f@linux-foundation.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20220505182136.e003eb59f846bb7839be4f6f@linux-foundation.org> X-Stat-Signature: bp3dann7jiouwy1ktrrezmpe99wh4rc8 X-Rspamd-Server: rspam07 X-Rspamd-Queue-Id: 6656FA0093 X-Rspam-User: Authentication-Results: imf25.hostedemail.com; dkim=pass header.d=infradead.org header.s=casper.20170209 header.b=vWg5OplV; dmarc=none; spf=none (imf25.hostedemail.com: domain of willy@infradead.org has no SPF policy when checking 90.155.50.34) smtp.mailfrom=willy@infradead.org X-HE-Tag: 1651801144-83806 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 Thu, May 05, 2022 at 06:21:36PM -0700, Andrew Morton wrote: > On Wed, 4 May 2022 19:28:39 +0100 "Matthew Wilcox (Oracle)" wrote: > > > The only caller already has a folio available, so this saves a conversion. > > Also convert the return type to boolean. > > > > ... > > > > --- a/include/linux/swap.h > > +++ b/include/linux/swap.h > > @@ -449,7 +449,7 @@ static inline unsigned long total_swapcache_pages(void) > > } > > > > extern void show_swap_cache_info(void); > > -extern int add_to_swap(struct page *page); > > +bool add_to_swap(struct folio *folio); > > extern void *get_shadow_from_swap_cache(swp_entry_t entry); > > extern int add_to_swap_cache(struct page *page, swp_entry_t entry, > > gfp_t gfp, void **shadowp); > > @@ -630,9 +630,9 @@ struct page *find_get_incore_page(struct address_space *mapping, pgoff_t index) > > return find_get_page(mapping, index); > > } > > > > -static inline int add_to_swap(struct page *page) > > +static inline bool add_to_swap(struct folio *folio) > > { > > - return 0; > > + return false; > > } > > > > Neil's "mm: create new mm/swap.h header file" moved this to mm/swap.h. > Simple enough. > > But mm/swap.h now gets its first mention of a folio yet it includes no > prerequisites. I guess the includer is responsible for including the > correct headers first, which is pretty sad, Yeah, I always like to see files include what they need. mm_types.h isn't a terrible file to include, and we don't need to worry about other header files including mm/swap.h. > My fingers are itching to add a forward declaration `struct folio;', > but I assume that isn't needed. We'll find out soon enough ;) Looking at the functions being provided in mm/swap.h, it seems to me that anyone who calls them is going to need the contents of page/folio anyway, so they're probably already including mm_types.h somehow anyway.