From patchwork Wed May 29 11:19:04 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: David Hildenbrand X-Patchwork-Id: 13678713 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 59424C25B75 for ; Wed, 29 May 2024 11:19:30 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 6E60F6B00A0; Wed, 29 May 2024 07:19:24 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 645616B00A4; Wed, 29 May 2024 07:19:24 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 424A36B00A6; Wed, 29 May 2024 07:19:24 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0016.hostedemail.com [216.40.44.16]) by kanga.kvack.org (Postfix) with ESMTP id 05A046B00A0 for ; Wed, 29 May 2024 07:19:23 -0400 (EDT) Received: from smtpin09.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay10.hostedemail.com (Postfix) with ESMTP id AD93DC0A35 for ; Wed, 29 May 2024 11:19:23 +0000 (UTC) X-FDA: 82171187406.09.A49BF0C Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.129.124]) by imf15.hostedemail.com (Postfix) with ESMTP id F0541A000C for ; Wed, 29 May 2024 11:19:21 +0000 (UTC) Authentication-Results: imf15.hostedemail.com; dkim=pass header.d=redhat.com header.s=mimecast20190719 header.b=FkGWzTNP; dmarc=pass (policy=none) header.from=redhat.com; spf=pass (imf15.hostedemail.com: domain of david@redhat.com designates 170.10.129.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=1716981562; 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=503jl45eQ6DH26oe7TpQo3EopwWo8mZfnH3eTedH2jo=; b=do++Q22k6qIUCdbyVgg4aI50jTd20eKZeGZ6wq1onBC3QvpiylY4WiaPi9yc9Jsy/V6DX/ Bj87U0q871eQcpxRk4VFpSu+99xT9ZsmLCfryowf7Ers1Lg7i0TtROxpLivjeUP8eNgleL ZTxXTMVEOxy4moX3PjixfQdOCu9T2Ic= ARC-Authentication-Results: i=1; imf15.hostedemail.com; dkim=pass header.d=redhat.com header.s=mimecast20190719 header.b=FkGWzTNP; dmarc=pass (policy=none) header.from=redhat.com; spf=pass (imf15.hostedemail.com: domain of david@redhat.com designates 170.10.129.124 as permitted sender) smtp.mailfrom=david@redhat.com ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1716981562; a=rsa-sha256; cv=none; b=fLfbWhMEMHPMtILiUGeEGeLcENKOkFZ/9e8WHT0vnTp4q6G9DKjBFhBoc1XTRZEdLW6DXg ZBCJxdCHdcwGLU8fStVPNFcUyCCicDeDsTl/1Kld7+jUMtVlrB+VxmnHzuZZmKWqaa5fEe itJH7EAPXbH/giXWfoa6ThytviKSnuE= DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1716981561; 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=503jl45eQ6DH26oe7TpQo3EopwWo8mZfnH3eTedH2jo=; b=FkGWzTNPcBu12XnbrYcgxx+FqGK5qY02Oaf1Wtz6qP8P720WiVTZWOBSkGMfM3u1p2Qrmy uZMOrKBFFtgADCz8NCnoOBFc1rZctq/3vDbIjJ4tPPTuF5/VcWO9wzwEjYfDKpfpgRNxk2 7WeaGsDo2JvzkUC0Muut5qZ7p7/4eUo= 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-609-jaInmsy4NLOfXj_IkOsLPQ-1; Wed, 29 May 2024 07:19:19 -0400 X-MC-Unique: jaInmsy4NLOfXj_IkOsLPQ-1 Received: from smtp.corp.redhat.com (int-mx08.intmail.prod.int.rdu2.redhat.com [10.11.54.8]) (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 3E2B185A58C; Wed, 29 May 2024 11:19:19 +0000 (UTC) Received: from t14s.fritz.box (unknown [10.39.193.127]) by smtp.corp.redhat.com (Postfix) with ESMTP id 9DAFDC15BB9; Wed, 29 May 2024 11:19:17 +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 v2 6/6] mm/mm_init: initialize page->_mapcount directly in __init_single_page() Date: Wed, 29 May 2024 13:19:04 +0200 Message-ID: <20240529111904.2069608-7-david@redhat.com> In-Reply-To: <20240529111904.2069608-1-david@redhat.com> References: <20240529111904.2069608-1-david@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 3.4.1 on 10.11.54.8 X-Rspamd-Queue-Id: F0541A000C X-Stat-Signature: xgk1sht3ng6hhg66wd6w1wyn65xy16yb X-Rspam-User: X-Rspamd-Server: rspam04 X-HE-Tag: 1716981561-404475 X-HE-Meta: U2FsdGVkX1/HDrADaZEBObJJEAbTQzU2xXRhFe7SSYYH6RjmibI4Zdyced68riRI4g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sJLgpcjNl1ogrSPgxnpTt6lPNoPIvHacRz6PgsMKhpgHSNcZA6Y563rPI7hbRrhjGhrIL2aWJNTKhN9d2xstx9Mxzs8eY2mBfX0SQTZlLAZ+c1nQTI9J 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 ----- mm/mm_init.c | 2 +- 2 files changed, 1 insertion(+), 6 deletions(-) diff --git a/include/linux/mm.h b/include/linux/mm.h index eebfce8f58bca..c41c82bcbec2f 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/mm/mm_init.c b/mm/mm_init.c index e0023aa685556..426314eeecec3 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);