From patchwork Wed May 22 21:03:41 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: David Hildenbrand X-Patchwork-Id: 13671082 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 84F6EC25B78 for ; Wed, 22 May 2024 21:04:09 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id EAB8A6B009E; Wed, 22 May 2024 17:04:06 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id E5BB76B009D; Wed, 22 May 2024 17:04:06 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id CD4886B009E; Wed, 22 May 2024 17:04:06 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0011.hostedemail.com [216.40.44.11]) by kanga.kvack.org (Postfix) with ESMTP id A91D56B009C for ; Wed, 22 May 2024 17:04:06 -0400 (EDT) Received: from smtpin01.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay03.hostedemail.com (Postfix) with ESMTP id 563AFA4B76 for ; Wed, 22 May 2024 21:04:06 +0000 (UTC) X-FDA: 82147259292.01.BC7A5B8 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 9970040019 for ; Wed, 22 May 2024 21:04:04 +0000 (UTC) Authentication-Results: imf07.hostedemail.com; dkim=pass header.d=redhat.com header.s=mimecast20190719 header.b=U0FDIkZL; dmarc=pass (policy=none) header.from=redhat.com; spf=pass (imf07.hostedemail.com: domain of david@redhat.com designates 170.10.133.124 as permitted sender) smtp.mailfrom=david@redhat.com ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1716411844; 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-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references:dkim-signature; bh=pNNk1s4j6/1176F8MI21H7X7UFnb72xKHXVGsllS3eQ=; b=IcCXYFmOdiTNBezLJZIh3in7eXuE4CAVvTERxN7hQU9cEejeR1fOpYIT2mdjEweAKpIe+p G0YmF3BnOoM50wCgk4YAMt7We1YkYHx5W5mM8//T/ESF9bCwf1SJQBdvKziNkw/E5k2IHX hraCNUQRL+5lWK2DJWjhCpPgf8zh3Yk= ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1716411844; a=rsa-sha256; cv=none; b=Km7AcboCb8dyJ78xuq0RoIqbqOXsyP2PJlDiZh5avKhx405PKm16zuHBLlma50a4z0NOIN bqof651MOerK7G2f8kINs2FIEJJrZzdErX6QpfdO7UTuh/eSKNUPp0IUwkqxk+vICnOj8Z S7WAT/MveY0h8w/jJAjnIgrS5AU5G7U= ARC-Authentication-Results: i=1; imf07.hostedemail.com; dkim=pass header.d=redhat.com header.s=mimecast20190719 header.b=U0FDIkZL; dmarc=pass (policy=none) header.from=redhat.com; spf=pass (imf07.hostedemail.com: domain of david@redhat.com designates 170.10.133.124 as permitted sender) smtp.mailfrom=david@redhat.com DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1716411844; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=pNNk1s4j6/1176F8MI21H7X7UFnb72xKHXVGsllS3eQ=; b=U0FDIkZL3hWLMmX7qmNKcRkWOrJv7yt968k0FiHLE6ftUR486CytCIa+J/JL405XF0CSP9 /5DiWiibZb3Z5KCyc1YNWPgMAaxm10petyaGn9JTOvVPv3c6GcQUv2tDlutcoimkK/5r0Z cVnrOvQoYPDtonLDIIsbGFlCW6HOkvE= Received: from mimecast-mx02.redhat.com (mimecast-mx02.redhat.com [66.187.233.88]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-422-ye0R7uQTPwaFaQc8HubRsQ-1; Wed, 22 May 2024 17:04:02 -0400 X-MC-Unique: ye0R7uQTPwaFaQc8HubRsQ-1 Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.rdu2.redhat.com [10.11.54.5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id A68A680118E; Wed, 22 May 2024 21:04:00 +0000 (UTC) Received: from t14s.fritz.box (unknown [10.39.192.4]) by smtp.corp.redhat.com (Postfix) with ESMTP id 315BF28E3; Wed, 22 May 2024 21:03:58 +0000 (UTC) From: David Hildenbrand To: linux-kernel@vger.kernel.org Cc: linux-mm@kvack.org, David Hildenbrand , Andrew Morton , "Matthew Wilcox (Oracle)" , Mike Rapoport , Minchan Kim , Sergey Senozhatsky , Hyeonggon Yoo <42.hyeyoo@gmail.com> Subject: [PATCH RFC 6/6] mm/mm_init: initialize page->_mapcount directly in__init_single_page() Date: Wed, 22 May 2024 23:03:41 +0200 Message-ID: <20240522210341.1030552-7-david@redhat.com> In-Reply-To: <20240522210341.1030552-1-david@redhat.com> References: <20240522210341.1030552-1-david@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 3.4.1 on 10.11.54.5 X-Stat-Signature: edoikuq9aitak1zd8usbdjmed39azo1k X-Rspamd-Queue-Id: 9970040019 X-Rspam-User: X-Rspamd-Server: rspam01 X-HE-Tag: 1716411844-374559 X-HE-Meta: U2FsdGVkX1+FyvfbF6ZzUqLdpfrgYQH/gTVNtz/1gBYGzlGCKI/Ga4tJ17P9LspQEzXhbAXA+LBGQdIZTwdL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SbgcByQ9VevEoiL2/DhW/rJuyukS/+YXbMBNYBdFYZURsjUxLquJrARIcxXKLPgEzJQj/fmlz3Lz2Bb0GB42G+p4KIn5BHorNVM0BAldJFDKNL 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: Let's simply reinitialize the page->_mapcount directly. We can now get rid of page_mapcount_reset(). Signed-off-by: David Hildenbrand --- include/linux/mm.h | 5 ----- include/linux/mm_types.h | 2 +- mm/mm_init.c | 2 +- 3 files changed, 2 insertions(+), 7 deletions(-) diff --git a/include/linux/mm.h b/include/linux/mm.h index 018e7c0265ca..3e1d3b0d545e 100644 --- a/include/linux/mm.h +++ b/include/linux/mm.h @@ -1206,11 +1206,6 @@ static inline int folio_entire_mapcount(const struct folio *folio) return atomic_read(&folio->_entire_mapcount) + 1; } -static inline void page_mapcount_reset(struct page *page) -{ - atomic_set(&(page)->_mapcount, -1); -} - /** * page_mapcount() - Number of times this precise page is mapped. * @page: The page. diff --git a/include/linux/mm_types.h b/include/linux/mm_types.h index 6dae8e15037b..c377c040f87d 100644 --- a/include/linux/mm_types.h +++ b/include/linux/mm_types.h @@ -169,7 +169,7 @@ struct page { * See page-flags.h for a list of page types which are currently * stored here. * - * Owners of typed folios may reuse the lower 16bit of the + * Owners of typed folios may reuse the lower 16 bit of the * head page page_type field after setting the page type, * but must reset these 16 bit to -1 before clearing the * page type. diff --git a/mm/mm_init.c b/mm/mm_init.c index f72b852bd5b8..b4916751edce 100644 --- a/mm/mm_init.c +++ b/mm/mm_init.c @@ -568,7 +568,7 @@ void __meminit __init_single_page(struct page *page, unsigned long pfn, mm_zero_struct_page(page); set_page_links(page, zone, nid, pfn); init_page_count(page); - page_mapcount_reset(page); + atomic_set(&page->_mapcount, -1); page_cpupid_reset_last(page); page_kasan_tag_reset(page);