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=-5.3 required=3.0 tests=BAYES_00, HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS, USER_AGENT_SANE_1 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 C268FC433EF for ; Thu, 23 Sep 2021 00:45:20 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id 5189F61050 for ; Thu, 23 Sep 2021 00:45:20 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.1 mail.kernel.org 5189F61050 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=intel.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=kvack.org Received: by kanga.kvack.org (Postfix) id 98B906B006C; Wed, 22 Sep 2021 20:45:19 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 937336B0071; Wed, 22 Sep 2021 20:45:19 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 8253D900002; Wed, 22 Sep 2021 20:45:19 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0065.hostedemail.com [216.40.44.65]) by kanga.kvack.org (Postfix) with ESMTP id 70FC86B006C for ; Wed, 22 Sep 2021 20:45:19 -0400 (EDT) Received: from smtpin15.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay03.hostedemail.com (Postfix) with ESMTP id 251D682499A8 for ; Thu, 23 Sep 2021 00:45:19 +0000 (UTC) X-FDA: 78616994358.15.F983A7B Received: from mga18.intel.com (mga18.intel.com [134.134.136.126]) by imf29.hostedemail.com (Postfix) with ESMTP id DE7A49000163 for ; Thu, 23 Sep 2021 00:45:17 +0000 (UTC) X-IronPort-AV: E=McAfee;i="6200,9189,10115"; a="210813797" X-IronPort-AV: E=Sophos;i="5.85,315,1624345200"; d="scan'208";a="210813797" Received: from fmsmga007.fm.intel.com ([10.253.24.52]) by orsmga106.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 22 Sep 2021 17:45:16 -0700 X-IronPort-AV: E=Sophos;i="5.85,315,1624345200"; d="scan'208";a="474900207" Received: from iweiny-desk2.sc.intel.com (HELO localhost) ([10.3.52.147]) by fmsmga007-auth.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 22 Sep 2021 17:45:15 -0700 Date: Wed, 22 Sep 2021 17:45:15 -0700 From: Ira Weiny To: Matthew Wilcox Cc: Kent Overstreet , Johannes Weiner , 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: Folio discussion recap Message-ID: <20210923004515.GD3053272@iweiny-DESK2.sc.intel.com> References: MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.11.1 (2018-12-01) X-Rspamd-Server: rspam01 X-Rspamd-Queue-Id: DE7A49000163 Authentication-Results: imf29.hostedemail.com; dkim=none; dmarc=fail reason="No valid SPF, No valid DKIM" header.from=intel.com (policy=none); spf=none (imf29.hostedemail.com: domain of ira.weiny@intel.com has no SPF policy when checking 134.134.136.126) smtp.mailfrom=ira.weiny@intel.com X-Stat-Signature: d4c16wscru8q6zy1g5gxd7sdz7m648h7 X-HE-Tag: 1632357917-622381 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 Tue, Sep 21, 2021 at 11:18:52PM +0100, Matthew Wilcox wrote: ... > +/** > + * page_slab - Converts from page to slab. > + * @p: The page. > + * > + * This function cannot be called on a NULL pointer. It can be called > + * on a non-slab page; the caller should check is_slab() to be sure > + * that the slab really is a slab. > + * > + * Return: The slab which contains this page. > + */ > +#define page_slab(p) (_Generic((p), \ > + const struct page *: (const struct slab *)_compound_head(p), \ > + struct page *: (struct slab *)_compound_head(p))) > + > +static inline bool is_slab(struct slab *slab) > +{ > + return test_bit(PG_slab, &slab->flags); > +} > + I'm sorry, I don't have a dog in this fight and conceptually I think folios are a good idea... But for this work, having a call which returns if a 'struct slab' really is a 'struct slab' seems odd and well, IMHO, wrong. Why can't page_slab() return NULL if there is no slab containing that page? Ira