Received: by 2002:ab2:7b86:0:b0:1f7:5705:b850 with SMTP id q6csp59656lqh; Fri, 3 May 2024 13:20:29 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCUjHuCKjltYfrVPgN/i04ndLlRVmCb5yA8gaXJFFVY1lQe3bCR2AgrYStuqtlQj8tQCHXKlg9PZn6UOKW/6yHfSmnpBiR//Ibr6FAd27Q== X-Google-Smtp-Source: AGHT+IEPvwccFdpm0HhtentQ2jMC/W9w0F7w+8JmOXRnNywWZYyJtpv0g0CVRNVABFHRxhAtrTp+ X-Received: by 2002:a05:6a20:8c09:b0:1aa:6100:3b01 with SMTP id j9-20020a056a208c0900b001aa61003b01mr3248254pzh.50.1714767628800; Fri, 03 May 2024 13:20:28 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1714767628; cv=pass; d=google.com; s=arc-20160816; b=Q5LLWXhLDC3r8eX2G9zSFrpqRZYiaZNQzG8R4XDO5/jKwMUcEUp3TnbAFdq/AOdrWf 00DbrVcMw+Zn8BTTqRaTntJiepWPVfkeqhSlrpLjmk+SjZ6T0y0g5M4DWIUqwqp/tE4g cEiTbIF2hiCnlbf35WAPTklKiqjmK1p0hjMHZXwV9uLapbp8QsnE71hgoJP7L6FVCY23 km5SFqmiJ8Vj6wYSRlLUZ4Bi28wXXoHZAxNA4Oi7Fx5BCV5ikgYUkKrB+j4t8t3BsWwv JfaRLtYsyIZiahfPMS85JshEj00aCouTh/cKhHV7Zf6J89E1eWw1ny8dNmbhH4tE/uQA jdwQ== 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=JKqNrvuJLggmC5OqLYhfJONRoO6KabgmLRg6AT9RabI=; fh=2zx0O8Bo+Y13S+6+MlBLwff6OLWyTKpDNk2pf8QOYFg=; b=ClbZDjfpr4c2aUFreIiNxxD2pSnprNVyAKJFWWGtb6GK9CJMQzyH8bryLifI0l+RaJ Agzy4ciYIfBL99y5dLERJGrNrXbfsj9DxW+evPXHiR8L0H6qeTgPY06s6fqWixGWIJNe wn+HkixoK18wdxuRk2gIptK+UgRSYdXDBGuf4xe8f0s2KJjlXQLLcFHAxi9XbxJJ7Pn6 UO7uhb2UeGSRpVwDfFNKWmiEtAksVDd7KipL9jecyPCI3oL2G6Ei6kHO0L1pCg/B8T/q S7Lui9CgIcCGM8IdU0t29eCarriywN9MhjoaFL5nurgfvw8P7x8PGtCAFCp8CemL6i9U qo0g==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@linux.dev header.s=key1 header.b=X1end8vy; arc=pass (i=1 spf=pass spfdomain=linux.dev dkim=pass dkdomain=linux.dev dmarc=pass fromdomain=linux.dev); spf=pass (google.com: domain of linux-kernel+bounces-168172-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-168172-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linux.dev Return-Path: Received: from sv.mirrors.kernel.org (sv.mirrors.kernel.org. [2604:1380:45e3:2400::1]) by mx.google.com with ESMTPS id i65-20020a639d44000000b0061c895529f5si2157922pgd.102.2024.05.03.13.20.28 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 03 May 2024 13:20:28 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-168172-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) client-ip=2604:1380:45e3:2400::1; Authentication-Results: mx.google.com; dkim=pass header.i=@linux.dev header.s=key1 header.b=X1end8vy; arc=pass (i=1 spf=pass spfdomain=linux.dev dkim=pass dkdomain=linux.dev dmarc=pass fromdomain=linux.dev); spf=pass (google.com: domain of linux-kernel+bounces-168172-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-168172-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linux.dev 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 sv.mirrors.kernel.org (Postfix) with ESMTPS id 93C05287B16 for ; Fri, 3 May 2024 20:19:36 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 827B6158D9D; Fri, 3 May 2024 20:19:06 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linux.dev header.i=@linux.dev header.b="X1end8vy" Received: from out-172.mta1.migadu.com (out-172.mta1.migadu.com [95.215.58.172]) (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 3A0D3158DDD for ; Fri, 3 May 2024 20:19:02 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=95.215.58.172 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1714767545; cv=none; b=gGQoXGEJS4JoQmw/pl2jQoT2PQMflX6dPyR2rbZ1XBSrvyzDt53hlmEjc6gizXmXYGyvgI46GKc7JyCHyD1++l4931Qyj+4JZ4LTypVS0m6mJyObeDyLLaAs/VsfuWZQSIxUjr6z7VYb17XTBD/v/rADKZaiDp738kXZdp5G4+E= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1714767545; c=relaxed/simple; bh=XtB/nDWzUuaQoEE1nrXkXmCUm/q+5PZbjs610J6ZoqY=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=qXTl0WQmnaRf5mbwO6Fu8zGU3gIKJwbxAocMHlQV5JD1tpAPN1bHvtBUgG9PKlCoQoMXrtXMlYRMwxJZL00/gE7ivjnke/AUGdKp3WY9+V6iofxqywIAZVcD7GUBfblFQMMd/AZu3aAux/EWI8QiQ9Az8+h7ZuOCrw6U+xgcX9k= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.dev; spf=pass smtp.mailfrom=linux.dev; dkim=pass (1024-bit key) header.d=linux.dev header.i=@linux.dev header.b=X1end8vy; arc=none smtp.client-ip=95.215.58.172 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.dev Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=linux.dev X-Report-Abuse: Please report any abuse attempt to abuse@migadu.com and include these headers. DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linux.dev; s=key1; t=1714767541; 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=JKqNrvuJLggmC5OqLYhfJONRoO6KabgmLRg6AT9RabI=; b=X1end8vyjH2Cs73oRfF/yOz2ktz9sYpRUK+x7oNmu2tq+bQa5lHERJlUtM+73U0qTOPPQQ XR1pNar1KYBNoITZqDD/VMIadCuC4OyQICElDvVWtwAuiURpnwquWqqn92U0dnHluQAlY1 iWtVPbQRcVBtpscG6yFZ5mu3j9czsxs= From: Roman Gushchin To: Andrew Morton Cc: Muchun Song , Johannes Weiner , Michal Hocko , Shakeel Butt , Frank van der Linden , linux-mm@kvack.org, linux-kernel@vger.kernel.org, Roman Gushchin Subject: [PATCH v1 4/4] mm: page_counters: initialize usage using ATOMIC_LONG_INIT() macro Date: Fri, 3 May 2024 13:18:35 -0700 Message-ID: <20240503201835.2969707-5-roman.gushchin@linux.dev> In-Reply-To: <20240503201835.2969707-1-roman.gushchin@linux.dev> References: <20240503201835.2969707-1-roman.gushchin@linux.dev> 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-Migadu-Flow: FLOW_OUT When a page_counter structure is initialized, there is no need to use an atomic set operation to initialize usage counters because at this point the structure is not visible to anybody else. ATOMIC_LONG_INIT() is what should be used in such cases. Signed-off-by: Roman Gushchin --- include/linux/page_counter.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/include/linux/page_counter.h b/include/linux/page_counter.h index 5d963f54fcb8..af636dd943a7 100644 --- a/include/linux/page_counter.h +++ b/include/linux/page_counter.h @@ -86,7 +86,7 @@ static inline void page_counter_init(struct page_counter *counter, int i; for (i = 0; i < __MCT_NR_ITEMS; i++) { - atomic_long_set(&counter->usage[i], 0); + counter->usage[i] = (atomic_long_t)ATOMIC_LONG_INIT(0); counter->max[i] = PAGE_COUNTER_MAX; } -- 2.43.2