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=-6.1 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,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 D537CC433B4 for ; Tue, 18 May 2021 14:17:14 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id 7E58B61007 for ; Tue, 18 May 2021 14:17:14 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 7E58B61007 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=redhat.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=owner-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix) id 038608E0035; Tue, 18 May 2021 10:17:14 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id F2A998E002F; Tue, 18 May 2021 10:17:13 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id D7D898E0035; Tue, 18 May 2021 10:17:13 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0081.hostedemail.com [216.40.44.81]) by kanga.kvack.org (Postfix) with ESMTP id A648F8E002F for ; Tue, 18 May 2021 10:17:13 -0400 (EDT) Received: from smtpin08.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay02.hostedemail.com (Postfix) with ESMTP id 401A57593 for ; Tue, 18 May 2021 14:17:13 +0000 (UTC) X-FDA: 78154553946.08.548019D Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) by imf07.hostedemail.com (Postfix) with ESMTP id E18E3A00018B for ; Tue, 18 May 2021 14:17:10 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1621347432; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=cNUKCr7oEW4YoycabUCZ5TkkkBmsnw3r2ErIPXCKNh8=; b=i12pKO1RKYDjcrP3hmNwAffhNhCxRoYhRDqQq6jXj0bG5DZuap+fL43ViQF1jOwn/RIlwI 9Nd+w60Gil0uHf7qOB67RlGOpp4mcVkM75zxHEVuvKmc4NZ1RsiIVQdM2PcJBgfvQ9gLe7 XjEpexGFx0ZydG3eA+wPQSK/pjG+DjE= Received: from mail-qv1-f70.google.com (mail-qv1-f70.google.com [209.85.219.70]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-224-tB7AsYfiM0m218fqfuDIpw-1; Tue, 18 May 2021 10:17:09 -0400 X-MC-Unique: tB7AsYfiM0m218fqfuDIpw-1 Received: by mail-qv1-f70.google.com with SMTP id i14-20020a0cf10e0000b02901eeced6480dso5923917qvl.4 for ; Tue, 18 May 2021 07:17:09 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:in-reply-to; bh=cNUKCr7oEW4YoycabUCZ5TkkkBmsnw3r2ErIPXCKNh8=; b=dEzXbedgPXvaBwlXCvx14pOUfPBcGlXqLd972pqoJpA0fJ+l6TvEOVmCr344sP05fl Z3kOSSiyCMfVIsZqkeOgQ4tjF5siElngWLkv0YOccinchWo77YKkhGllWkwdjpRqxith 9ALH0Qaux4JFcOGSYeIVo0DLhv5ZyqbpwGNGnaQj6qPAspRo1hhxfoxNs5vtKerN2cPh mIa30IyjhmrtCNPVTQknXX/H7jhC+kU5j7VOaBbm9gvR5WMyLPOvu3LBuAH+WwhnCHFJ JtEo5AyEUnyGi3Q58d6ERZIxrixyjfNJEmC4e7Zg3KoibYNSlHfb0HGXsY7TxlBYQN1U qvMw== X-Gm-Message-State: AOAM5338o3c3GRFQ7x++XwrEf5sNcXp7dcZLjY4S50T9JPmCTjOOGUjv rAYMiKjvsLMM7xpwiKxBENdjG82nn5e3CNjrg7gV/aI8cITs4/dKMCJvNToZuWoMS+zkbue9mDn q0cpFc5xFPZ4= X-Received: by 2002:a37:a854:: with SMTP id r81mr5567984qke.83.1621347429188; Tue, 18 May 2021 07:17:09 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwNwMG50chJ/VK9YBnzgEPGUA+fkxk4jQnSOcxrE0QnRfHFDXo6jlaBwydyt2CUYa9cICfbkQ== X-Received: by 2002:a37:a854:: with SMTP id r81mr5567929qke.83.1621347428799; Tue, 18 May 2021 07:17:08 -0700 (PDT) Received: from t490s (bras-base-toroon474qw-grc-72-184-145-4-219.dsl.bell.ca. [184.145.4.219]) by smtp.gmail.com with ESMTPSA id a23sm12742012qtd.60.2021.05.18.07.17.07 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 18 May 2021 07:17:07 -0700 (PDT) Date: Tue, 18 May 2021 10:17:06 -0400 From: Peter Xu To: Alistair Popple Cc: linux-mm@kvack.org, nouveau@lists.freedesktop.org, bskeggs@redhat.com, akpm@linux-foundation.org, linux-doc@vger.kernel.org, linux-kernel@vger.kernel.org, dri-devel@lists.freedesktop.org, jhubbard@nvidia.com, rcampbell@nvidia.com, jglisse@redhat.com, jgg@nvidia.com, hch@infradead.org, daniel@ffwll.ch, willy@infradead.org, bsingharora@gmail.com, Christoph Hellwig Subject: Re: [PATCH v8 1/8] mm: Remove special swap entry functions Message-ID: References: <20210407084238.20443-1-apopple@nvidia.com> <20210407084238.20443-2-apopple@nvidia.com> <2009782.faHf7sVjGQ@nvdebian> MIME-Version: 1.0 In-Reply-To: <2009782.faHf7sVjGQ@nvdebian> X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Authentication-Results: imf07.hostedemail.com; dkim=pass header.d=redhat.com header.s=mimecast20190719 header.b=i12pKO1R; dmarc=pass (policy=none) header.from=redhat.com; spf=none (imf07.hostedemail.com: domain of peterx@redhat.com has no SPF policy when checking 170.10.133.124) smtp.mailfrom=peterx@redhat.com X-Rspamd-Server: rspam05 X-Rspamd-Queue-Id: E18E3A00018B X-Stat-Signature: 9nogccciek9zwdejie7dj6pcpcsrjwwi X-HE-Tag: 1621347430-773175 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, May 18, 2021 at 09:58:09PM +1000, Alistair Popple wrote: > On Tuesday, 18 May 2021 12:17:32 PM AEST Peter Xu wrote: > > On Wed, Apr 07, 2021 at 06:42:31PM +1000, Alistair Popple wrote: > > > +static inline struct page *pfn_swap_entry_to_page(swp_entry_t entry) > > > +{ > > > + struct page *p = pfn_to_page(swp_offset(entry)); > > > + > > > + /* > > > + * Any use of migration entries may only occur while the > > > + * corresponding page is locked > > > + */ > > > + BUG_ON(is_migration_entry(entry) && !PageLocked(p)); > > > + > > > + return p; > > > +} > > > > Would swap_pfn_entry_to_page() be slightly better? > > > > The thing is it's very easy to read pfn_*() as a function to take a pfn as > > parameter... > > > > Since I'm also recently working on some swap-related new ptes [1], I'm > > thinking whether we could name these swap entries as "swap XXX entries". > > Say, "swap hwpoison entry", "swap pfn entry" (which is a superset of "swap > > migration entry", "swap device exclusive entry", ...). That's where I came > > with the above swap_pfn_entry_to_page(), then below will be naturally > > is_swap_pfn_entry(). > > Equally though "hwpoison swap entry", "pfn swap entry", "migration swap > entry", etc. also makes sense (at least to me), but does that not fit in as > well with your series? I haven't looked too deeply at your series but have > been meaning to so thanks for the pointer. Yeah it looks good too. It's just to avoid starting with "pfn_" I guess, so at least we know that's something related to swap not one specific pfn. I found the naming is important as e.g. in my series I introduced another idea called "swap special pte" or "special swap pte" (yeah so indeed my naming is not that coherent as well... :), then I noticed if without a good naming I'm afraid we can get lost easier. I have a description here in the commit message re the new swap special pte: https://lore.kernel.org/lkml/20210427161317.50682-5-peterx@redhat.com/ In which the uffd-wp marker pte will be the first swap special pte. Feel free to ignore the details too, just want to mention some context, while it should be orthogonal to this series. I think yet-another swap entry suites for my case too but it'll be a waste as in that pte I don't need to keep pfn information, but only a marker (one single bit would suffice), so I chose one single pte value (one for each arch, I only defined that on x86 in my series which is a special pte with only one bit set) to not pollute the swap entry address spaces. > > > No strong opinion as this is already a v8 series (and sorry to chim in this > > late), just to raise this up. > > No worries, it's good timing as I was about to send a v9 which was just a > rebase anyway. I am hoping to try and get this accepted for the next merge > window but I will wait before sending v9 to see if anyone else has thoughts on > the naming here. > > I don't have a particularly strong opinion either, and your justification is > more thought than I gave to naming these originally so am happy to rename if > it's more readable or fits better with your series. I'll leave the decision to you, especially in case you still prefer the old naming. Or feel free to wait too until someone else shares the thoughts so as to avoid unnecessary rebase work. Thanks, -- Peter Xu