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 5617FC49EA6 for ; Thu, 24 Jun 2021 15:52:20 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id DA4D161249 for ; Thu, 24 Jun 2021 15:52:19 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org DA4D161249 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 AC4C96B0036; Thu, 24 Jun 2021 11:52:18 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id A74B56B005D; Thu, 24 Jun 2021 11:52:18 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 93CC16B006C; Thu, 24 Jun 2021 11:52:18 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0140.hostedemail.com [216.40.44.140]) by kanga.kvack.org (Postfix) with ESMTP id 592D86B0036 for ; Thu, 24 Jun 2021 11:52:18 -0400 (EDT) Received: from smtpin32.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay04.hostedemail.com (Postfix) with ESMTP id 6194222AB5 for ; Thu, 24 Jun 2021 15:52:18 +0000 (UTC) X-FDA: 78289059156.32.BC0D2A4 Received: from casper.infradead.org (casper.infradead.org [90.155.50.34]) by imf03.hostedemail.com (Postfix) with ESMTP id 0F00BC00F785 for ; Thu, 24 Jun 2021 15:52:16 +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=RhOughdPQBT8FH1TMb9mE3gkCHTQi+TVzms17GvbwF4=; b=rgTJ5jhkLChatsb8/9DhxRKKlK XqXuAqqgu0z7SI+WEhiWiUDaik6wSA4GU/op+TcncBjx/2cuXPqSOsuYPA1mf4UvEBWh81tWuHIRZ DsMXSjsH3nOuoEuOU/pOMPihqSv7zMZJ9ylt4JfjWd/kb5msg5HIOxQJ4C5GgWoP3Xy8rEeSFcTjU i5haAaP+y/afjxw887oqx8TIsmyxzxu5CJqBZ52B4Qa3SkrfXnZaj15eAUlA3d1v8CSHfla0dYJGh wQlxkX3VfkbHCFIJ9jU8D0MliVK2EWIXq+pActYJoxUhWd8l0izXSTGs0+0p27ihIb48SxXUK8L6A 10ohojPQ==; Received: from willy by casper.infradead.org with local (Exim 4.94.2 #2 (Red Hat Linux)) id 1lwRe3-00GjYi-NI; Thu, 24 Jun 2021 15:52:03 +0000 Date: Thu, 24 Jun 2021 16:51:59 +0100 From: Matthew Wilcox To: Christoph Hellwig Cc: akpm@linux-foundation.org, linux-fsdevel@vger.kernel.org, linux-mm@kvack.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH v2 02/46] mm: Add folio_rmapping() Message-ID: References: <20210622121551.3398730-1-willy@infradead.org> <20210622121551.3398730-3-willy@infradead.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: Authentication-Results: imf03.hostedemail.com; dkim=pass header.d=infradead.org header.s=casper.20170209 header.b=rgTJ5jhk; spf=none (imf03.hostedemail.com: domain of willy@infradead.org has no SPF policy when checking 90.155.50.34) smtp.mailfrom=willy@infradead.org; dmarc=none X-Stat-Signature: xau3hhuun7bmjzxmo6yyh81zh4gjm67i X-Rspamd-Queue-Id: 0F00BC00F785 X-Rspamd-Server: rspam06 X-HE-Tag: 1624549936-201034 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, Jun 23, 2021 at 09:56:58AM +0200, Christoph Hellwig wrote: > > +static inline void *folio_rmapping(struct folio *folio) > > This name, just like the old one is not exaclty descriptive. I guess the > r stands for raw somehow? As a casual contributor to the fringes of the > MM I would have no idea when to use it. > > All this of course also applies to the existing (__)page_rmapping, but > maybe this is a good time to sort it out. Yes, good point. I don't like the name rmapping either, since we already have rmap which has nothing to do with this. I'll leave page_rmapping() alone for now; no need to add that churn. I think they all become calls to folio_raw_mapping() later. > > > > struct anon_vma *page_anon_vma(struct page *page) > > { > > + struct folio *folio = page_folio(page); > > + unsigned long mapping = (unsigned long)folio->mapping; > > > > if ((mapping & PAGE_MAPPING_FLAGS) != PAGE_MAPPING_ANON) > > return NULL; > > + return folio_rmapping(folio); > > It feelds kinda silly to not just open code folio_rmapping here > given that we alredy went half the way. Yeah, I thought about that too. Done: - return folio_rmapping(folio); + return (void *)(mapping - PAGE_MAPPING_ANON);