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 mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 01008C433EF for ; Thu, 7 Oct 2021 14:37:12 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id 913E261130 for ; Thu, 7 Oct 2021 14:37:11 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.1 mail.kernel.org 913E261130 Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=suse.cz Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=kvack.org Received: by kanga.kvack.org (Postfix) id EEF876B0071; Thu, 7 Oct 2021 10:37:10 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id E9F096B0072; Thu, 7 Oct 2021 10:37:10 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id DB4FA900002; Thu, 7 Oct 2021 10:37:10 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0082.hostedemail.com [216.40.44.82]) by kanga.kvack.org (Postfix) with ESMTP id CF6AA6B0071 for ; Thu, 7 Oct 2021 10:37:10 -0400 (EDT) Received: from smtpin15.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay01.hostedemail.com (Postfix) with ESMTP id 87CEF183CEED5 for ; Thu, 7 Oct 2021 14:37:10 +0000 (UTC) X-FDA: 78669893820.15.D30564E Received: from smtp-out1.suse.de (smtp-out1.suse.de [195.135.220.28]) by imf12.hostedemail.com (Postfix) with ESMTP id 01BDF1001AAC for ; Thu, 7 Oct 2021 14:37:09 +0000 (UTC) Received: from imap2.suse-dmz.suse.de (imap2.suse-dmz.suse.de [192.168.254.74]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (P-521) server-digest SHA512) (No client certificate requested) by smtp-out1.suse.de (Postfix) with ESMTPS id E33DB2244C; Thu, 7 Oct 2021 14:37:08 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.cz; s=susede2_rsa; t=1633617428; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc: mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=YPSnZbkEIcq104FYIBgq5TYP7yBK8f8mhYAs6+fTXHY=; b=N7w8whBYhLCUJLtssd8NxyFVAUHAZNclAacxDzzbzMlzczZtvTgV/U5uXBE8qZVxTR6qh3 +4n1AwmAErSpozZYBwrVFZC+UwWXQzOtRMBzhJLf+xGX95D0OXWzGuP8Ho6k2828wIUrFj Fh56O975vW/P3LQn+q3sUSHE16lcfNw= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.cz; s=susede2_ed25519; t=1633617428; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc: mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=YPSnZbkEIcq104FYIBgq5TYP7yBK8f8mhYAs6+fTXHY=; b=1Rs2jlHdc0fuDgTYW9nLD3KOAJm4zQd6HW0GLu1kYfsm/HJswNvZqfAC1uxIlCmwfW0Zvx zgipvAA1C2UDk7AQ== Received: from imap2.suse-dmz.suse.de (imap2.suse-dmz.suse.de [192.168.254.74]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (P-521) server-digest SHA512) (No client certificate requested) by imap2.suse-dmz.suse.de (Postfix) with ESMTPS id C7B0D13CE5; Thu, 7 Oct 2021 14:37:08 +0000 (UTC) Received: from dovecot-director2.suse.de ([192.168.254.65]) by imap2.suse-dmz.suse.de with ESMTPSA id sCUfMBQGX2EkXwAAMHmgww (envelope-from ); Thu, 07 Oct 2021 14:37:08 +0000 Message-ID: Date: Thu, 7 Oct 2021 16:37:08 +0200 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:91.0) Gecko/20100101 Thunderbird/91.1.2 Content-Language: en-US To: Matthew Wilcox , linux-mm@kvack.org, David Hildenbrand , Kent Overstreet , Johannes Weiner , linux-fsdevel@vger.kernel.org References: From: Vlastimil Babka Subject: Re: [RFC] pgflags_t In-Reply-To: Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit X-Rspamd-Server: rspam02 X-Rspamd-Queue-Id: 01BDF1001AAC X-Stat-Signature: ajcdkhttttph1g7k3kp59cxkb5jdcbcm Authentication-Results: imf12.hostedemail.com; dkim=pass header.d=suse.cz header.s=susede2_rsa header.b=N7w8whBY; dkim=pass header.d=suse.cz header.s=susede2_ed25519 header.b=1Rs2jlHd; spf=pass (imf12.hostedemail.com: domain of vbabka@suse.cz designates 195.135.220.28 as permitted sender) smtp.mailfrom=vbabka@suse.cz; dmarc=none X-HE-Tag: 1633617429-265379 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 10/6/21 16:58, Matthew Wilcox wrote: > David expressed some unease about the lack of typesafety in patches > 1 & 2 of the page->slab conversion [1], and I'll admit to not being > particularly a fan of passing around an unsigned long. That crystallised > in a discussion with Kent [2] about how to lock a page when you don't know > its type (solution: every memory descriptor type starts with a > pgflags_t) > > So this patch is a step towards typesafety for pgflags_lock() by > changing the type of page->flags from a bare unsigned long to a > struct encapsulating an unsigned long. A few users can already benefit > from passing around a pgflags_t, but most just append '.f' to get at > the unsigned long. Also, most of them only do it for logging/tracing. > > [1] https://lore.kernel.org/linux-mm/02a055cd-19d6-6e1d-59bb-e9e5f9f1da5b@redhat.com/ > [2] https://lore.kernel.org/linux-mm/YVyQpPuwIGFSSEQ8@casper.infradead.org/ > ... > diff --git a/mm/debug.c b/mm/debug.c > index fae0f81ad831..48af9829aee9 100644 > --- a/mm/debug.c > +++ b/mm/debug.c > @@ -162,7 +162,7 @@ static void __dump_page(struct page *page) > out_mapping: > BUILD_BUG_ON(ARRAY_SIZE(pageflag_names) != __NR_PAGEFLAGS + 1); > > - pr_warn("%sflags: %#lx(%pGp)%s\n", type, head->flags, &head->flags, > + pr_warn("%sflags: %#lx(%pGp)%s\n", type, head->flags.f, &head->flags.f, The %pGp case (here and elsewhere) could perhaps take the new type, no? Would need to change format_page_flags() and flags_string() in lib/vsprintf.c