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 EB1F6C433B4 for ; Tue, 18 May 2021 02:17:38 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id C82F861073 for ; Tue, 18 May 2021 02:17:38 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1346235AbhERCSz (ORCPT ); Mon, 17 May 2021 22:18:55 -0400 Received: from us-smtp-delivery-124.mimecast.com ([170.10.133.124]:35349 "EHLO us-smtp-delivery-124.mimecast.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S237378AbhERCSy (ORCPT ); Mon, 17 May 2021 22:18:54 -0400 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-f70.google.com (mail-qv1-f70.google.com [209.85.219.70]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-320-2BuNmJSYMtywAyUyOuB_3A-1; Mon, 17 May 2021 22:17:35 -0400 X-MC-Unique: 2BuNmJSYMtywAyUyOuB_3A-1 Received: by mail-qv1-f70.google.com with SMTP id n12-20020a0cdc8c0000b02901efdf8d3bc7so3467249qvk.23 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=cWao5c0oeQpieJXzr4Bl3M4HEU/AcAwfGnI2e5ecCagjXo2Cd/OyJgyXAKmWFOTLWn D0YKudrzjsb/PqfAaozP2VJeGQasJLms55SCE0Q+6YVCB/hR711MiLSKjPl51JAkuyfr PK3Zw4dM4DjBGcH4JTa7absL3pp0ZfsvWFbTofBRmHdm3p/vhemKoIfy7JfwhnBbxh98 WAmvE22j4RTj1SKbwciJUz4DN9yrn6mFl4tza8riNCDh0YrbgRCWBvzk5CwWyEhILXMZ rs1ivRhRZKt+LpBuG5lPRnPorNqfPj/vUOa/jvIJbyKIrZeWu4pXZDf4YZ39LDlt91Lo pFtQ== X-Gm-Message-State: AOAM531ZZPtibqooPObIvF69mESlJTEO2ORbKY68HoI629UxpA5x0V6U v3qmnm5pQEdNnz8iTt6mgfj9zG9PTJRM8U+aD07Ynyen1zsjaV94snyatFCIhnqCYJe+w11hzA/ moNe/GSl3d+dtu23qykyn X-Received: by 2002:a37:acc:: with SMTP id 195mr3056554qkk.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 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline In-Reply-To: <20210407084238.20443-2-apopple@nvidia.com> Precedence: bulk List-ID: X-Mailing-List: linux-doc@vger.kernel.org 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 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.6 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 6F1A7C433ED for ; Tue, 18 May 2021 02:17:52 +0000 (UTC) Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 34FC361263 for ; Tue, 18 May 2021 02:17:52 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 34FC361263 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=redhat.com Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=nouveau-bounces@lists.freedesktop.org Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id BF0BA6E5AB; Tue, 18 May 2021 02:17:51 +0000 (UTC) Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) by gabe.freedesktop.org (Postfix) with ESMTPS id 9CDA06E5A3 for ; Tue, 18 May 2021 02:17:38 +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-f70.google.com (mail-qv1-f70.google.com [209.85.219.70]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-362-9hy_ZxqmOMS6xXeBtKHzQg-1; Mon, 17 May 2021 22:17:36 -0400 X-MC-Unique: 9hy_ZxqmOMS6xXeBtKHzQg-1 Received: by mail-qv1-f70.google.com with SMTP id d11-20020a0cdb0b0000b02901c0da4391d5so6241717qvk.12 for ; Mon, 17 May 2021 19:17:36 -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=lXSTZWQtisx3yyu/3e7Jiv/UmMHTC0CtEzUbTQOUMEWktOcVZ3LBQEMrys+m6M2qZW DKeafQ/4D3KNbHrFMTdeppQReEYtfsXLS1Vf+sFdE3ax5lGcQAIl/Lw0xc8hXE82ChDg 2iMs1dP9HWiLz7heT+ajLKssGDXz3GZrNiCnhldg4J+QUoihuoMjKykhLJCX8QHf4VTl xlHlQ+DIPeM5sKfuUTbbr6cbptlEZkis0jOMUkc5tTEn4NNeMdtzgPxbwbxC2O6O1iXu UUIfv0FOf5XrOhsViaggjY+xyOvjsWUWIzgXLh7qgeEgVG30qPW77CagfVc+GZS+kYrF IxhQ== X-Gm-Message-State: AOAM533PSJycFH5K0hpOGzrZSnuzuICap+PX0Eekxhyx9H6WWpZcfACB js9IJh+3d5gwFYu/0DI02H1680/Z8rjQk89+Z15H6l2MlXcQ91JjbuNoouYdwxEAaPATzGD/hNH dpvO8r42g9Ys3s/511zxy330k0g== X-Received: by 2002:a37:acc:: with SMTP id 195mr3056566qkk.237.1621304254983; 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 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> Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=peterx@redhat.com X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Disposition: inline X-Mailman-Approved-At: Tue, 18 May 2021 02:17:50 +0000 Subject: Re: [Nouveau] [PATCH v8 1/8] mm: Remove special swap entry functions X-BeenThere: nouveau@lists.freedesktop.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Nouveau development list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: rcampbell@nvidia.com, willy@infradead.org, daniel@ffwll.ch, linux-doc@vger.kernel.org, nouveau@lists.freedesktop.org, bsingharora@gmail.com, linux-kernel@vger.kernel.org, dri-devel@lists.freedesktop.org, hch@infradead.org, linux-mm@kvack.org, bskeggs@redhat.com, jgg@nvidia.com, akpm@linux-foundation.org, Christoph Hellwig Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Errors-To: nouveau-bounces@lists.freedesktop.org Sender: "Nouveau" 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 _______________________________________________ Nouveau mailing list Nouveau@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/nouveau 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.6 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 4F8DFC43461 for ; Tue, 18 May 2021 02:17:41 +0000 (UTC) Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 1641C61073 for ; Tue, 18 May 2021 02:17:41 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 1641C61073 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=redhat.com Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=dri-devel-bounces@lists.freedesktop.org Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id BEBDC6E5A3; Tue, 18 May 2021 02:17:39 +0000 (UTC) Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) by gabe.freedesktop.org (Postfix) with ESMTPS id 18B216E5A3 for ; Tue, 18 May 2021 02:17:38 +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-qk1-f198.google.com (mail-qk1-f198.google.com [209.85.222.198]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-320-0K_DdJUjMGCoVOYlZOx05w-1; Mon, 17 May 2021 22:17:35 -0400 X-MC-Unique: 0K_DdJUjMGCoVOYlZOx05w-1 Received: by mail-qk1-f198.google.com with SMTP id u9-20020a05620a4549b02902e956c2a3c8so6058474qkp.20 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=jrDEZp2NcQukTWdqolwK0F9c+7+K0uhEa1SBBWLiuBtnhrU8IO+0jzcVlcucJ0YQse RTAJgf9KW4xXYAfISYOkNFwac6/CRNgU4PPAIAKQJqUoMafZaJpEUd/OTj5171pdLfIc L2hcK629TPZyE+MTsJ8/W7A9UYqY/T1FS4ZhF+gV7X7geIBcFv9kPdDxqKIGxtLJ1cvc fi41J4xz3qNUXKtwSyIhc6Y6xjYbkCXwUMLziDwFssUHjiMLZM1szXQOH/lwynKvVHIh PTBot0Ifh4ZLPSm6z9FxND2MgkZqBC5pQFryBj1HKFInjngHihvUYFJ+j9iKXu67jZRn AFug== X-Gm-Message-State: AOAM5303ule+9W0hJ2YyH/VbK2A5N49yqYussr1R2qE1jQATal6PuXdH qyv96C0lQYovl21kdcaF6KpRDLuJxlKMgUBUvJkG7t4wzaXG0SmBbH/j/pnKQCd1Q7DlvUMqXLr VrfNrlL1L1cwMmbOfKKcFShLSyeKE X-Received: by 2002:a37:acc:: with SMTP id 195mr3056555qkk.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 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> Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=peterx@redhat.com X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Type: text/plain; charset=utf-8 Content-Disposition: inline X-BeenThere: dri-devel@lists.freedesktop.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Direct Rendering Infrastructure - Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: rcampbell@nvidia.com, willy@infradead.org, linux-doc@vger.kernel.org, nouveau@lists.freedesktop.org, bsingharora@gmail.com, linux-kernel@vger.kernel.org, dri-devel@lists.freedesktop.org, hch@infradead.org, linux-mm@kvack.org, jglisse@redhat.com, bskeggs@redhat.com, jgg@nvidia.com, jhubbard@nvidia.com, akpm@linux-foundation.org, Christoph Hellwig Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" 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