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 Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by smtp.lore.kernel.org (Postfix) with ESMTP id 99A67C27C5E for ; Mon, 10 Jun 2024 04:49:16 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 2DC836B0098; Mon, 10 Jun 2024 00:49:16 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 23DAE6B009B; Mon, 10 Jun 2024 00:49:16 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 0DDF46B009C; Mon, 10 Jun 2024 00:49:16 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0015.hostedemail.com [216.40.44.15]) by kanga.kvack.org (Postfix) with ESMTP id DFB1D6B0098 for ; Mon, 10 Jun 2024 00:49:15 -0400 (EDT) Received: from smtpin09.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay03.hostedemail.com (Postfix) with ESMTP id 7A940A0D29 for ; Mon, 10 Jun 2024 04:49:15 +0000 (UTC) X-FDA: 82213749870.09.91CFC51 Received: from smtp-out1.suse.de (smtp-out1.suse.de [195.135.223.130]) by imf17.hostedemail.com (Postfix) with ESMTP id 4909E40008 for ; Mon, 10 Jun 2024 04:49:13 +0000 (UTC) Authentication-Results: imf17.hostedemail.com; dkim=pass header.d=suse.de header.s=susede2_rsa header.b=GU+QqmkW; dkim=pass header.d=suse.de header.s=susede2_ed25519 header.b=2Xu3G1CW; dkim=pass header.d=suse.de header.s=susede2_rsa header.b=GU+QqmkW; dkim=pass header.d=suse.de header.s=susede2_ed25519 header.b=2Xu3G1CW; spf=pass (imf17.hostedemail.com: domain of osalvador@suse.de designates 195.135.223.130 as permitted sender) smtp.mailfrom=osalvador@suse.de; dmarc=pass (policy=none) header.from=suse.de ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1717994953; a=rsa-sha256; cv=none; b=5/xcvwZOxrA8Nl0ZDdBviJI9H2DHb3ARMPoacyNQom5yuwueaSzaEAk5zRuUFoi25TtRk3 otbfDgmC5uXURmpqwm/nUb9eL4jasCgNEdlT6xfAqEg397CdJufYkpGJtMB2qViHK/DgV7 VAsE520zdOpagSoxfuy+pIcOFqi682Q= ARC-Authentication-Results: i=1; imf17.hostedemail.com; dkim=pass header.d=suse.de header.s=susede2_rsa header.b=GU+QqmkW; dkim=pass header.d=suse.de header.s=susede2_ed25519 header.b=2Xu3G1CW; dkim=pass header.d=suse.de header.s=susede2_rsa header.b=GU+QqmkW; dkim=pass header.d=suse.de header.s=susede2_ed25519 header.b=2Xu3G1CW; spf=pass (imf17.hostedemail.com: domain of osalvador@suse.de designates 195.135.223.130 as permitted sender) smtp.mailfrom=osalvador@suse.de; dmarc=pass (policy=none) header.from=suse.de ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1717994953; h=from:from:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-type:content-transfer-encoding: in-reply-to:in-reply-to:references:references:dkim-signature; bh=8CnYPnGkfnl4u6bw5KXqozmF5Gw9xCjdvsWRN0WG0YI=; b=KdgNLIMvyS42CjanBCYiCX8QuKyGMKp9NCsgL4b4OIxzc7J803DAwgzgOgKrOYLCBA6s84 zkxghFSq2H2R1g0a86Ge9KqW7yWQD3tKg1kZCN/3SzYldF7h52sy3b/GUhnLVdYcAimJEU tkTD4FEf0+IBbIhSysE8UO4EfnLTHuY= Received: from imap1.dmz-prg2.suse.org (unknown [10.150.64.97]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by smtp-out1.suse.de (Postfix) with ESMTPS id C550621A28; Mon, 10 Jun 2024 04:49:11 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_rsa; t=1717994951; h=from:from:reply-to: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=8CnYPnGkfnl4u6bw5KXqozmF5Gw9xCjdvsWRN0WG0YI=; b=GU+QqmkWmqkb/WMg/Xw/lZuzX3xYTh1mLoVT83OkJcaDQwirJhkizproDDRneLrofKGJAq To7ZsWuthJJaGNitkyQufQLtGZAS7NXzgGJ34bIlwgXpw3HhUzwFbAX6M1msfFvzvQkb8K csvnoKcKvUfXfrm2MBY++t7llliP4Ps= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_ed25519; t=1717994951; h=from:from:reply-to: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=8CnYPnGkfnl4u6bw5KXqozmF5Gw9xCjdvsWRN0WG0YI=; b=2Xu3G1CWjQMBrWHWy+Raxz32I23yOu3otkTScqrd3tZDMsuGh+mcx7LkNVMoKq4hljq7NZ /Of0G/J2YjneYuDw== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_rsa; t=1717994951; h=from:from:reply-to: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=8CnYPnGkfnl4u6bw5KXqozmF5Gw9xCjdvsWRN0WG0YI=; b=GU+QqmkWmqkb/WMg/Xw/lZuzX3xYTh1mLoVT83OkJcaDQwirJhkizproDDRneLrofKGJAq To7ZsWuthJJaGNitkyQufQLtGZAS7NXzgGJ34bIlwgXpw3HhUzwFbAX6M1msfFvzvQkb8K csvnoKcKvUfXfrm2MBY++t7llliP4Ps= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_ed25519; t=1717994951; h=from:from:reply-to: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=8CnYPnGkfnl4u6bw5KXqozmF5Gw9xCjdvsWRN0WG0YI=; b=2Xu3G1CWjQMBrWHWy+Raxz32I23yOu3otkTScqrd3tZDMsuGh+mcx7LkNVMoKq4hljq7NZ /Of0G/J2YjneYuDw== Received: from imap1.dmz-prg2.suse.org (localhost [127.0.0.1]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by imap1.dmz-prg2.suse.org (Postfix) with ESMTPS id 610C913A7F; Mon, 10 Jun 2024 04:49:11 +0000 (UTC) Received: from dovecot-director2.suse.de ([2a07:de40:b281:106:10:150:64:167]) by imap1.dmz-prg2.suse.org with ESMTPSA id 0AUaFceFZmZYHAAAD6G6ig (envelope-from ); Mon, 10 Jun 2024 04:49:11 +0000 Date: Mon, 10 Jun 2024 06:49:09 +0200 From: Oscar Salvador To: David Hildenbrand Cc: linux-kernel@vger.kernel.org, linux-mm@kvack.org, linux-doc@vger.kernel.org, linux-fsdevel@vger.kernel.org, Andrew Morton , Jonathan Corbet Subject: Re: [PATCH v1 2/6] fs/proc/task_mmu: don't indicate PM_MMAP_EXCLUSIVE without PM_PRESENT Message-ID: References: <20240607122357.115423-1-david@redhat.com> <20240607122357.115423-3-david@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20240607122357.115423-3-david@redhat.com> X-Rspamd-Queue-Id: 4909E40008 X-Rspam-User: X-Rspamd-Server: rspam12 X-Stat-Signature: rq4im3c6g73k6onxuszarfnrauij44jf X-HE-Tag: 1717994953-669702 X-HE-Meta: U2FsdGVkX193wYkLbbGbo6tzEKj1M7JkVQj4UmWm3NQcI6/+kh0ohQZxBIIdBrtPfCruU8UxUa+PxklUDsvAKq/UeJUJUwZxNu2gp1B2blGVgyYd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C74sj8OunGTz5hyysTFR0kjlLmVwr/UN/SI//Y94Wv1h1NsBOy347gKmEhF7jFZIplqNIG7EvByIdcn0Q== 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: List-Subscribe: List-Unsubscribe: On Fri, Jun 07, 2024 at 02:23:53PM +0200, David Hildenbrand wrote: > Relying on the mapcount for non-present PTEs that reference pages > doesn't make any sense: they are not accounted in the mapcount, so > page_mapcount() == 1 won't return the result we actually want to know. > > While we don't check the mapcount for migration entries already, we > could end up checking it for swap, hwpoison, device exclusive, ... > entries, which we really shouldn't. > > There is one exception: device private entries, which we consider > fake-present (e.g., incremented the mapcount). But we won't care about > that for now for PM_MMAP_EXCLUSIVE, because indicating PM_SWAP for them > although they are fake-present already sounds suspiciously wrong. > > Let's never indicate PM_MMAP_EXCLUSIVE without PM_PRESENT. > > Signed-off-by: David Hildenbrand Forgot to comment on something: > @@ -1517,14 +1514,13 @@ static int pagemap_pmd_range(pmd_t *pmdp, unsigned long addr, unsigned long end, > if (pmd_swp_uffd_wp(pmd)) > flags |= PM_UFFD_WP; > VM_BUG_ON(!is_pmd_migration_entry(pmd)); > - migration = is_migration_entry(entry); > page = pfn_swap_entry_to_page(entry); We do not really need to get the page anymore here as that is the non-present part. Then we could get away without checking the flags as only page != NULL would mean a present pmd. Not that we gain much as this is far from being a hot-path, but just saying.. -- Oscar Salvador SUSE Labs