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 D275CC43460 for ; Tue, 18 May 2021 02:17:39 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id 6427061263 for ; Tue, 18 May 2021 02:17:39 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 6427061263 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 CFDA26B00A9; Mon, 17 May 2021 22:17:38 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id CADFF6B00AB; Mon, 17 May 2021 22:17:38 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id B27FE8E0002; Mon, 17 May 2021 22:17:38 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0107.hostedemail.com [216.40.44.107]) by kanga.kvack.org (Postfix) with ESMTP id 7E4926B00A9 for ; Mon, 17 May 2021 22:17:38 -0400 (EDT) Received: from smtpin24.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay03.hostedemail.com (Postfix) with ESMTP id 22AF3824999B for ; Tue, 18 May 2021 02:17:38 +0000 (UTC) X-FDA: 78152740596.24.DABDF01 Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [216.205.24.124]) by imf04.hostedemail.com (Postfix) with ESMTP id 5E3453C5 for ; Tue, 18 May 2021 02:17:36 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1621304257; 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=SHUED2xywhieoA8Ohgqwa/BFwS5IrraVCcyW37p8oEc=; b=HAxnpIeBAIgJ2cFctu//SWzGseRHbxULUCXTn6S3D1aEZCJnKItOGl0sX/uCMDVNTF8XgH iW+tWZzT46YNUKe49wkGl5iWQwna8b11bN2BINLH39Zd7f3i5a3LKa00hOMCK+WKx3qtGO vTVyNS5T7oglx0nJM7vxEkEhneqonPs= Received: from mail-qv1-f71.google.com (mail-qv1-f71.google.com [209.85.219.71]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-15-k7SkLmlSNzWIC6UhPhnF8A-1; Mon, 17 May 2021 22:17:35 -0400 X-MC-Unique: k7SkLmlSNzWIC6UhPhnF8A-1 Received: by mail-qv1-f71.google.com with SMTP id f17-20020a0cf3d10000b02901eda24e6b92so6274860qvm.1 for ; Mon, 17 May 2021 19:17:35 -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=SHUED2xywhieoA8Ohgqwa/BFwS5IrraVCcyW37p8oEc=; b=ecYCWDhrdoxSbISS16cM0Gf5pr5D3B/8pU6uNyT08UK8dPD61k2N36K0u0eZ57lN5j kx/rnHxa/Vyv7x8EZAq8W2lYV7iugWJ1ToSDt3H4p30GSGkGkMVYslTjTa5+A6qHCCz/ NwOWPqW9+CDT4HnX0u7JK1s7lAwUfADwFZshlwQtSmoQEd1Y83engLzuQ5vT8gVkJ91J sCom5MNfIzpy9lJPUmv6ZQHZApH33DQdW00+Uh0zz+RUypeys0Cdr5w7KWC+kb2HrRNY uGcJ/dJHQ9IMncf15MJvmNRlsCQ/AUOG42qxPstOg/70hUtwlunyW46f9ka8gR50uLko qSuQ== X-Gm-Message-State: AOAM532u2pyttGh4+/rtq3K92ucgcnJ8SdRW5tccg0SGsX6x7xqRzEhP 9RvGQDYgW8rr4TG35hzPLzjOuQJorhhW/UwOhj1KcocDUa444ybV0cNDIRZmykIIw/obJ/DYWLH gwdz/AnGQoLc= X-Received: by 2002:a37:acc:: with SMTP id 195mr3056559qkk.237.1621304254982; Mon, 17 May 2021 19:17:34 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzvfhDruyVRENBywFHKAF09zhJc/VYjDjiU6UtKjssWV4m2MY09oz2Ie4CFZZ05uo8IZIWTfA== X-Received: by 2002:a37:acc:: with SMTP id 195mr3056543qkk.237.1621304254755; Mon, 17 May 2021 19:17:34 -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 q185sm11488655qkd.69.2021.05.17.19.17.33 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 17 May 2021 19:17:34 -0700 (PDT) Date: Mon, 17 May 2021 22:17:32 -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> MIME-Version: 1.0 In-Reply-To: <20210407084238.20443-2-apopple@nvidia.com> X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Authentication-Results: imf04.hostedemail.com; dkim=pass header.d=redhat.com header.s=mimecast20190719 header.b=HAxnpIeB; spf=none (imf04.hostedemail.com: domain of peterx@redhat.com has no SPF policy when checking 216.205.24.124) smtp.mailfrom=peterx@redhat.com; dmarc=pass (policy=none) header.from=redhat.com X-Rspamd-Server: rspam01 X-Rspamd-Queue-Id: 5E3453C5 X-Stat-Signature: 748jtg9qswefm438i613ktd5yn661w64 X-HE-Tag: 1621304256-543517 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, 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(). No strong opinion as this is already a v8 series (and sorry to chim in this late), just to raise this up. [1] https://lore.kernel.org/lkml/20210427161317.50682-1-peterx@redhat.com/ Thanks, > + > +/* > + * A pfn swap entry is a special type of swap entry that always has a pfn stored > + * in the swap offset. They are used to represent unaddressable device memory > + * and to restrict access to a page undergoing migration. > + */ > +static inline bool is_pfn_swap_entry(swp_entry_t entry) > +{ > + return is_migration_entry(entry) || is_device_private_entry(entry); > +} -- Peter Xu