Message ID | 20240503201835.2969707-5-roman.gushchin@linux.dev (mailing list archive) |
---|---|
State | New |
Headers | show
Return-Path: <owner-linux-mm@kvack.org> 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 0B75EC4345F for <linux-mm@archiver.kernel.org>; Fri, 3 May 2024 20:19:09 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 3AB996B0096; Fri, 3 May 2024 16:19:05 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 35D316B0098; Fri, 3 May 2024 16:19:05 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 1B0376B0099; Fri, 3 May 2024 16:19:05 -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 EBE596B0096 for <linux-mm@kvack.org>; Fri, 3 May 2024 16:19:04 -0400 (EDT) Received: from smtpin17.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay09.hostedemail.com (Postfix) with ESMTP id 802B281167 for <linux-mm@kvack.org>; Fri, 3 May 2024 20:19:04 +0000 (UTC) X-FDA: 82078198608.17.518719F Received: from out-178.mta1.migadu.com (out-178.mta1.migadu.com [95.215.58.178]) by imf01.hostedemail.com (Postfix) with ESMTP id CC88140005 for <linux-mm@kvack.org>; Fri, 3 May 2024 20:19:02 +0000 (UTC) Authentication-Results: imf01.hostedemail.com; dkim=pass header.d=linux.dev header.s=key1 header.b=X1end8vy; dmarc=pass (policy=none) header.from=linux.dev; spf=pass (imf01.hostedemail.com: domain of roman.gushchin@linux.dev designates 95.215.58.178 as permitted sender) smtp.mailfrom=roman.gushchin@linux.dev ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1714767543; 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=JKqNrvuJLggmC5OqLYhfJONRoO6KabgmLRg6AT9RabI=; b=e8QhG/wishyeqbtcq54D/o0y5P82C9VRtbVa9fDhp8V20cbIYnqOT/MYjCM0ia3fGFMSoB bX/45CmfdQjnEAeuOv/nK5fcV+YOAyUCRCejAR/wgnZ8UlXpVHIbFUQl6DTzB9uB3lGy0w t0/ZfV2UxGfnZBtN3B768nki63fWBKM= ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1714767543; a=rsa-sha256; cv=none; b=S5NwiHfIKeZpkNect9PM/3ACGTybtNoWy7I7szGoqHnWkK6Q1EZ9qfvD3wlszudgwGI9Jq hngTpHPJdAi52welQm9c1eb7vy+QQWGEHeqXDoaDRZEsqp6ajnj+WGlNxcsdol+OZQwJdE LE+TqeyAUpNjLnVssN0dRwHEk0nuToM= ARC-Authentication-Results: i=1; imf01.hostedemail.com; dkim=pass header.d=linux.dev header.s=key1 header.b=X1end8vy; dmarc=pass (policy=none) header.from=linux.dev; spf=pass (imf01.hostedemail.com: domain of roman.gushchin@linux.dev designates 95.215.58.178 as permitted sender) smtp.mailfrom=roman.gushchin@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 <roman.gushchin@linux.dev> To: Andrew Morton <akpm@linux-foundation.org> Cc: Muchun Song <muchun.song@linux.dev>, Johannes Weiner <hannes@cmpxchg.org>, Michal Hocko <mhocko@kernel.org>, Shakeel Butt <shakeel.butt@linux.dev>, Frank van der Linden <fvdl@google.com>, linux-mm@kvack.org, linux-kernel@vger.kernel.org, Roman Gushchin <roman.gushchin@linux.dev> 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> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Migadu-Flow: FLOW_OUT X-Rspamd-Server: rspam08 X-Rspamd-Queue-Id: CC88140005 X-Stat-Signature: 5jqdkye1dx4hd6dz1f159mizzt38auc8 X-Rspam-User: X-HE-Tag: 1714767542-383051 X-HE-Meta: U2FsdGVkX18Q/IGHaWWKCN/86q57ak5Q3+RuNBCNEIA3fWa+a8zI3cMTXVUcUR+wkCuAGQV8B4O/E8TL4bZNNXeBbRxKocLfrWZOb+achww0nwRdsgrS9690WCvNKpfy4QBIwqZXgLfJ5YoSmZQ1Y0FzFsBcGKDCnErlN/+/HShnN3/9Nlgjnipksb9F1KAb6tFoeEnreXjCnmlvgBptGTzsnGQixf2zgRs5Gp1U3dqX5nqqJPgFQ4TvHTwdubeq4uh/03YbXqq1ShFfe8/YXMHo89uPJulDOk+BH4K4WI1MjVOdw0S45RJxQwydcPeHm+QhcHohMFXT9wRO0s/AlFrnBOqkJbV/QuAoy5gYko8CgmLCwRQlD/RdC7sOpRtiplE/nTsJC5vYkk3zfxYAOYv47sElL8QV/YNH8aNgJIjN9q7i26e6J5TzGMsTH8gWj4mDPDHYj/u6iXVDBXvB+O2rMipUkBx7bD/TZ7nsgdH0kCw4A2jHghTQbUZmOVqN+uSuxIxOhLBZQa5lgdYM71AyxZjsiGwRfMXlNt7CdalxhsElY0o6PVwGjKIeLEDyGbJCGeIL/0hniMQTu+s6j7i+MinPPnq5SHMKhNRUTw4U4jZSf5WXC2OyIwu6+7kuVi7GbBL+9Gc/9fGejZiJMPl7Pxg5VPnXYlPWqkduKLBF3vy7RAIM63DfWuwmcSOcXsCVuXdhhJ0y0yctvyVerW34QuK/j3xDPNGLaVQ7+vXkZA3a1VIKiai1X3Uoor5LL6oFmmYIhqlDpZrgPDRe43JEqvvWzM510ssJRb2+R6qP+zhWyPIXJaPE/MUfFb116uxX2isciO/54436gv24pJmZD9RneoIdb3OjOQ0xuW3nZbmymv93cfS+dYwLpMEBExwHLsmKmeczri+MkQimvwwARj7exGnTmbFMoDxK8ZUbeYdz2XU53XFQ9FIojF8wjz9xF+FqC2ptogN73uL Wyq+YFXv MqE4TgnnBBuw/wkdygLPKtQXJLBsU6CF4SgaWycdfNuQrszn8UB/4DIGXCjJa3tt5dyt06w1z7qTa3WqtG74bMcKswZ8IM1VHnU/k7FTkpB3OEgAlkPVuiUH+PuZnbmCVw2Ap 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: <linux-mm.kvack.org> List-Subscribe: <mailto:majordomo@kvack.org> List-Unsubscribe: <mailto:majordomo@kvack.org> |
Series |
Page counters optimizations
|
expand
|
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; }
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 <roman.gushchin@linux.dev> --- include/linux/page_counter.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)