Received: by 2002:ab2:7855:0:b0:1f9:5764:f03e with SMTP id m21csp608098lqp; Wed, 22 May 2024 14:05:34 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCWzSOo6fLDzCLija0FLP322JX4jhMQAo721ZAd/T0vIK0zcDKTnlJwiD8Xd0k/Vf0d5ORI8UT2B8XKmH3tpUaBNUg3ND/5kDIIyVN/lzQ== X-Google-Smtp-Source: AGHT+IGNDEIZWKrtiC7YWTiOv2BDyLO/lX+w1TSkEih3M+il7srTQfg276CooHOUBMGQMO8Nh6w0 X-Received: by 2002:a17:903:245:b0:1f2:f6ec:9a40 with SMTP id d9443c01a7336-1f31c9e675emr42268105ad.44.1716411934328; Wed, 22 May 2024 14:05:34 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1716411934; cv=pass; d=google.com; s=arc-20160816; b=w+5e0WddaN5cRz12my511gOegdUZHX5R6pyqtNOatIG6IT9XUl3qrlGMKpb3zb/4ZV E+Eu/R/IaUJCX3vOsTAJvgcuL3V7Uj9mEeu+M7iTloWmipP/Vh/jLWHtdrI0pSy2iVc2 ksiMr7ZXHHTsZ9fOcEtPSKKuaNFfu6Y+m4lbfF6yDUEPCordw8Kv76qF7ggNN0DnI3my 7s+uzqp1/kMo3naFUL/ujWqoSlpngCCRyJo4AaiBaU7CoVcF36gYw8vkI2xnVnhdQVNZ n/WDWcZulhGaf4RVtfQdfteBtI6pKO0N8TtXtd3/RVfhY++bucR6WiFk+AdWcazz7Xij AwvA== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:references:in-reply-to:message-id :date:subject:cc:to:from:dkim-signature; bh=pNNk1s4j6/1176F8MI21H7X7UFnb72xKHXVGsllS3eQ=; fh=4qo2wXwF6+wBmVpKt9nE5vXwAOEbbhXPZvwe/C5tp4o=; b=KkhGvjDAjaXWPUb+RWktrnbc8mUmFHc1XZEzFq3v0zMYgx9s4hmlqAu+ub4xHTPiRd q6JdbiCZkEF0x+Dg34UaHna0ycSPeLkLLA2EeJVTq0vzmHKPKWufUObRDDi5vFKP4l5g ddAG+6MADAeVL/YHB1KH54BWidmmKNXZax5R4zxfydOCOrJUPoqUim3rSvUr3pOQF1HT yHgZv0zi1RCoMNe55wUWw2NC4ntav8H/ef8lMDQ2ltrfzKeIuDSUVE2ruKVBwtzxO+XH LfFGntrOff904BiFaI2vTVz3xbnNSjPYtn+oYNCGb4SZWDSyK/Zv/w5lyVBEPp3X1+P5 bUDw==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=O4cb8Ppd; arc=pass (i=1 spf=pass spfdomain=redhat.com dkim=pass dkdomain=redhat.com dmarc=pass fromdomain=redhat.com); spf=pass (google.com: domain of linux-kernel+bounces-186711-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:40f1:3f00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-186711-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com Return-Path: Received: from sy.mirrors.kernel.org (sy.mirrors.kernel.org. [2604:1380:40f1:3f00::1]) by mx.google.com with ESMTPS id d9443c01a7336-1f2fed2ac0asi33749075ad.645.2024.05.22.14.05.33 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 22 May 2024 14:05:34 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-186711-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:40f1:3f00::1 as permitted sender) client-ip=2604:1380:40f1:3f00::1; Authentication-Results: mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=O4cb8Ppd; arc=pass (i=1 spf=pass spfdomain=redhat.com dkim=pass dkdomain=redhat.com dmarc=pass fromdomain=redhat.com); spf=pass (google.com: domain of linux-kernel+bounces-186711-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:40f1:3f00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-186711-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by sy.mirrors.kernel.org (Postfix) with ESMTPS id 25BD7B21AB0 for ; Wed, 22 May 2024 21:04:59 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id DECD0146A91; Wed, 22 May 2024 21:04:08 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=redhat.com header.i=@redhat.com header.b="O4cb8Ppd" Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id AC3921482F2 for ; Wed, 22 May 2024 21:04:06 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=170.10.133.124 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1716411848; cv=none; b=JYQaMw60jGakkyVdWhXCH+my4JNnRip/uvwgfYzAoHZH2RGedqBj0dIN2IBDzBPEa2yWulD9UmWLbIF15WF+YetPh2qJK9rzLZVvTWFwnPV3GHTOjlSkUCG/eOetvKtSPlI88Px+eFCWxibSeO+01Dx0TaOeBN7/IS+wb2K2gpo= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1716411848; c=relaxed/simple; bh=VREeDSWzeQL6HFzOo4DCIAgPmrdV23oWLwOUQziKCX4=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=H300EcYEwJx4iWH+qz64QW8ScmFMTl5hSmr7NVksOl39whqA/rq8sFCZZ3i9EmfBHiJu0eFCV9E7fm6ggBVLxbMxnsZpSV4C/c5ttju3dFgl37xNTXqBJde7+191ap2PBvDVAFZqMjmkTlMCVb50+NKVYnmEGPXgqhwC/J6F+XM= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=redhat.com; spf=pass smtp.mailfrom=redhat.com; dkim=pass (1024-bit key) header.d=redhat.com header.i=@redhat.com header.b=O4cb8Ppd; arc=none smtp.client-ip=170.10.133.124 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=redhat.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=redhat.com DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1716411845; 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=O4cb8Ppd/DC99x9KdH6ni1RdJOrw6k1pX6mdgQ/C5zAEODPlYObkpIHyCWqHp72YthmaDJ H+pQOrdw1Ud5lCxw4TNu57CXi5IdPGE6auCl69KwY3HG8DNeMz6epHdlGkirBBQ4Traq/f zMBRgCGydYo4w+PFItRf0gGZfgeuL0w= 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> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Scanned-By: MIMEDefang 3.4.1 on 10.11.54.5 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); -- 2.45.0