Received: by 2002:a05:6500:1b8f:b0:1fa:5c73:8e2d with SMTP id df15csp559823lqb; Wed, 29 May 2024 04:20:33 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCX18aB9KDGtvKwrkFGlqXzaRKzJhVJTJknl+Anfh280Y2ifV3CFPBQe0sXk0w1RKoL4MhojdI70eYTY0oDo44Ng2rHbUyhs2Jpr53N0Fg== X-Google-Smtp-Source: AGHT+IFo09vH8ZHyD6dmKZWEFNp07CEuYYZhS2O77v19FFkmEXyScUkJMUtrRq7lbv/0Oc3TZ7N2 X-Received: by 2002:a17:906:4682:b0:a64:722f:5a2f with SMTP id a640c23a62f3a-a64722f5a74mr109246066b.42.1716981633561; Wed, 29 May 2024 04:20:33 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1716981633; cv=pass; d=google.com; s=arc-20160816; b=AZP1+/NhIwOYw+Etw8058k7uBkPPl+QEbubiAhySTEeqHvBKQHpUYWkUB7YtD9x6mG B5mQSOkr5JxVZKKVbS8ngJWm9Uu1gyldco0tXtKasbN2p+RtvqVRtvBiK1Ag0I97i5XH OIAILKHPJgksVIJLwS29hVRx/pos+zEu1iEyVx9jAFw4n4XHqUpS9h+qTBR0jEvkTWse qzOd91olcrCh5spVtwLWrol3SvqxurGmepquXV9Ffkk/HbylXMC26zc5knQpBDeCP4MT A6bHN99w+YARo2I2LfNZw2A0Nz0egsitcWh6BkU8847dj0zj57Xm+ExN+jqnEDJFHzWJ +gXA== 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=503jl45eQ6DH26oe7TpQo3EopwWo8mZfnH3eTedH2jo=; fh=4qo2wXwF6+wBmVpKt9nE5vXwAOEbbhXPZvwe/C5tp4o=; b=LCUscAxEymp9GnmvmI5nDFmr1RxySSkjJ2/VGvGIBJm+9lOGqzvpOHPVSvveBObAhE ghyrYybKjMUyq0XAUhlZY7KZSPrQaSSFQt4U/ywy/yAEzKQyL1E0GgWUWcr3HBL6IgAj T+0AOvmqVCnj0725JzXS+S0A44gwiKbtaOl4/0N7lHNUDordagPJTdRtxU1zhdDd+u1d gsHEmvJt8ZIMr27krO6j16CIZ4GrGoeEAUIHSVwyU6iA6MbGazcJKRv6ZNkl8Sg81ENb Yp9yrJzhztE2/rRWtmYpgxFLrxEwz+22KuCycpEp+Xb3cFWqJlHPYB0JqXxFXq/9k92r goHg==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=h23b6e1B; 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-194010-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) smtp.mailfrom="linux-kernel+bounces-194010-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com Return-Path: Received: from am.mirrors.kernel.org (am.mirrors.kernel.org. [2604:1380:4601:e00::3]) by mx.google.com with ESMTPS id a640c23a62f3a-a634f3cd31bsi170745666b.759.2024.05.29.04.20.33 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 29 May 2024 04:20:33 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-194010-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) client-ip=2604:1380:4601:e00::3; Authentication-Results: mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=h23b6e1B; 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-194010-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) smtp.mailfrom="linux-kernel+bounces-194010-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 am.mirrors.kernel.org (Postfix) with ESMTPS id 4C6141F26056 for ; Wed, 29 May 2024 11:20:33 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 56226181B8C; Wed, 29 May 2024 11:19:25 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=redhat.com header.i=@redhat.com header.b="h23b6e1B" Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.129.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 1F3BE181300 for ; Wed, 29 May 2024 11:19:22 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=170.10.129.124 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1716981564; cv=none; b=sr0ipeDqTT1HTnYsHCx2+B6R9r5abDyYqQV4d/hzWbYcfxBSNgf9dMjodywTwJdUI6A6Uc/JWgQQgE8zPwj3BcLy1+6/KQRpnblr98Hlci4RK1mE154TCjppsF1y5S1+Z4WvEDaTnxRDGLxrRYDgqD7NvyT87Bs3Xx/gIWyjxS8= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1716981564; c=relaxed/simple; bh=OrtHN7gm6sG7/e44ksUr1jsieGg46k546PJ3cCa5NdE=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=S/6Opr29y49R+tRWZ7ns9N4LUFYQmIg9Mb3xGj7qH/e0HnoFw+da4qfdXmHF2cNJ+E/cxRsFPYGgn5S/hryFpdcjc21BHuju/qK8zgVLJZMoFYkuuFcJPOe+IGSwAqfCaq3e6Z+E4DGis8Bew/tYLn1dUDrB/q0Un3RcnliilBk= 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=h23b6e1B; arc=none smtp.client-ip=170.10.129.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=1716981562; 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=h23b6e1BiZmOdspkExb2c/aKQ7NIbdcL7jFLuCGGfMVcRbejSQ/ThcwFmT5n4N5musRcDq tGPXqXkObuN+obOm6vt9HUYG8yA+Y/svwQdStWt5lET6gQzdi8o5zJ8m29cRtGvOM/wkvH pYfpzykC1v163lmhbtV8o0VzW/Pmp8U= 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> 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.8 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); -- 2.45.1