From patchwork Wed Jul 24 20:21:02 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Roman Gushchin X-Patchwork-Id: 13741327 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 419E8C3DA63 for ; Wed, 24 Jul 2024 20:21:24 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id C121F6B0095; Wed, 24 Jul 2024 16:21:23 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id BBF776B0098; Wed, 24 Jul 2024 16:21:23 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id A89986B0096; Wed, 24 Jul 2024 16:21:23 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0017.hostedemail.com [216.40.44.17]) by kanga.kvack.org (Postfix) with ESMTP id 7C41F6B0092 for ; Wed, 24 Jul 2024 16:21:23 -0400 (EDT) Received: from smtpin26.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay03.hostedemail.com (Postfix) with ESMTP id 1BF8DA0B93 for ; Wed, 24 Jul 2024 20:21:22 +0000 (UTC) X-FDA: 82375766046.26.E03A06B Received: from out-177.mta1.migadu.com (out-177.mta1.migadu.com [95.215.58.177]) by imf08.hostedemail.com (Postfix) with ESMTP id 45923160019 for ; Wed, 24 Jul 2024 20:21:21 +0000 (UTC) Authentication-Results: imf08.hostedemail.com; dkim=pass header.d=linux.dev header.s=key1 header.b=CaspnUm7; spf=pass (imf08.hostedemail.com: domain of roman.gushchin@linux.dev designates 95.215.58.177 as permitted sender) smtp.mailfrom=roman.gushchin@linux.dev; dmarc=pass (policy=none) header.from=linux.dev ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1721852434; 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=Ox/nuFAuZgruc6XJ+rhxVAoq5JDC1MSgTKgd+A57sfY=; b=YYLJLrmEiEgxoQZp8QloTTasT/1qqEHXLtRHL+U/BQYZkpiE6aIzcTvVzhKM9ANRXOaR4Y WDVvHd6nTJL4GJUw9p7sxTgJ405FfYgaUSu/TEAz/LkyiL1l1wtSwSM23V0xHLAeeb9/5H TFyOVlGwrCesgX+gnT1Y9PmGza1VzfQ= ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1721852434; a=rsa-sha256; cv=none; b=PLnd/Ut1XMHyQU6MvrRQREHf82tRDpLIFH20JaNv+QXgT/wCtH88CNYlgBkR+zTbRRK3Ak 4h8LbRzHn/7+ULiPg9MU5xqF+lDVBUjPbuEq4SsIBEd5v2P5KTNVeWTGcxMNtyrHbfXx+4 he0cBqH+xj7kfjO9i13ebuQDWDWnYGA= ARC-Authentication-Results: i=1; imf08.hostedemail.com; dkim=pass header.d=linux.dev header.s=key1 header.b=CaspnUm7; spf=pass (imf08.hostedemail.com: domain of roman.gushchin@linux.dev designates 95.215.58.177 as permitted sender) smtp.mailfrom=roman.gushchin@linux.dev; dmarc=pass (policy=none) header.from=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=1721852479; 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=Ox/nuFAuZgruc6XJ+rhxVAoq5JDC1MSgTKgd+A57sfY=; b=CaspnUm7bqY8Cjk8c/ux144Bt4fYLCd41UyWZi7sAowFl+0d9E4eQqZiql4QiFzGCuXPmw xFaabCNGMpNcAZ66AtgYb4KS/8woN4ZpzrqNfS+g98tE0HgVctnYqVOdiXsXOk7a6TqGqR Fkv8B27X337kVEMdE4iBHQrJgUzUgp8= From: Roman Gushchin To: Andrew Morton Cc: linux-mm@kvack.org, linux-kernel@vger.kernel.org, Johannes Weiner , Michal Hocko , Shakeel Butt , Muchun Song , Roman Gushchin Subject: [PATCH v2 4/5] mm: page_counters: initialize usage using ATOMIC_LONG_INIT() macro Date: Wed, 24 Jul 2024 20:21:02 +0000 Message-ID: <20240724202103.1210065-5-roman.gushchin@linux.dev> In-Reply-To: <20240724202103.1210065-1-roman.gushchin@linux.dev> References: <20240724202103.1210065-1-roman.gushchin@linux.dev> MIME-Version: 1.0 X-Migadu-Flow: FLOW_OUT X-Rspamd-Queue-Id: 45923160019 X-Stat-Signature: fepehtuyheh7itib78xaqadtqw8dfgek X-Rspamd-Server: rspam09 X-Rspam-User: X-HE-Tag: 1721852481-771944 X-HE-Meta: U2FsdGVkX19p8r6Kahv/IgqiPdi9jAAcyMy9omweext1t8AZa5rWjcOrbwPsSzcqE95B5DtHZBe6XNGLzCuVzod6mggO6JrD7CPoRLp4pKC6YoaVb27U3gPOc/qF6662je+OnmJw7r/r2y8FT8jZi32XzlbfjLbZBlZbseVNFr1/JSB4qXNYxlPmo32kjLXtRv9trxUBoRy1+gK5dTh+H1+C7Bx3EmJ1FLK1i/LwyZ1qrkYJwSgmL7NrFyXWIafi5UTYLoMfXYsnvECJbviRp6rU41u6BwsP7Ik3wRPi13fgahoZE0hY18jM8LRCuD+WJX0TVryxrpgiisaKVhniftz8QAeXHTOa/1abWZP7Dtx5/vvWRpMl/wHScNb0P0OwUJdKhutTu3gqkbdbXONYeZXBTZ/+t8A4lxLjJ9ivmu/1wQkEZ9ldYEcPayaFavnboOf1YHStOxXKn7dhnMq8lYMktZz3KEf7iS3zQOINBR+id/PODq19uYk05Y9XcanGtbqiPNBM9yh2IFiVR9a+FOy6fxrkCBv1rBRDKjpKlq6tXfHxzlILwKmXnD79KYgodUKsong/8YdpysFVpuZXczUsWj4JjfSGdoHt43wHUAnZLwvf755JmzKBAUOCK4Ifk4QmdVgsomxBu8qzas+5ABrP7GsgSEiTc5jtF2DlPkuOjFe/6yfyp6U2rOal5OK/C/1ylH2D7Com6fzgtZNgHGsrIRipLUSpLQ9Yx8Pc+o6Jqn9wzmff1S9S5b5tiRK/VDkN7JBJyb2b684j/vvocmlqf1orep6h+jDoulrh/8RMoWDjiJlPZC/jnT72Rphbu4zggfb+8klcfp2RFXOY0lk+O4E+qsrGR1KLmzpD7UmDHG9pmIwmFrC3N5qhJji2rkcHHvo1pQ8XA7CsPwNOL8ViciZ9M9QOPqQpbaZnD7BTHGXeQQLnS1AbrH4HaVx5lSBnnw1cXhoHzVZLqLE wW9daf5k F7MvNdrE46kRNpHN0zffX84FS+6nna5rZAEZlQ+z+CHbMqrOJau9QWE1mHi1ZLBxSA46KyVwduFAlWDkbDm7h8iP5m6+3xb6aXSfnal24PbakvfmNKVeK+KUlSlUphx4a30yiGk9hdeRH8/S7XApWZlYIg6Kb5cF0XWsm 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: 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 Acked-by: Shakeel Butt --- 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 701e1255c456..ee740ed8cb90 100644 --- a/include/linux/page_counter.h +++ b/include/linux/page_counter.h @@ -114,7 +114,7 @@ static inline void page_counter_init(struct page_counter *counter, unsigned long 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; } counter->parent = parent;