From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mail-qk1-f175.google.com (mail-qk1-f175.google.com [209.85.222.175]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 170B519DF4B for ; Fri, 17 Jan 2025 16:56:17 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.222.175 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1737132981; cv=none; b=XqVL23cNs8XuulaLs7TWcjGodqYzV+V6cm3UV139kJJlpQHbUI6IVBI83YND3k5ZxpNST0m12SSE3o8sEHnHlW0BbDw1HMFReEiEsDuRTqFzy75A/fgJJn6SZFaqHkFAvzbtN4S5Ykwm4xNmOyl+KZ5dpmVUBgfEGzAUYbSe8Go= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1737132981; c=relaxed/simple; bh=EcKTRL8JXgL6MYjimVIRKmKtsAaC6f8InOAt5ItXdT4=; h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version: Content-Type:Content-Disposition:In-Reply-To; b=Ips4sWcuyu7rgTzX4aEUyTsJj+l5t6A/S2zanseiKNyOsbdZriK0XyPAwDN9m/KeSNJOucTYXF6bfC78Z5J7ZhZRiSJXXXzp9y2vSTPleoNb1pMaRnO2SLIDRLFzDE0RtBUYO5hvItMX6OIDYOqtDedScSI1hG+VDMgWnas8Moc= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=cmpxchg.org; spf=pass smtp.mailfrom=cmpxchg.org; dkim=pass (2048-bit key) header.d=cmpxchg-org.20230601.gappssmtp.com header.i=@cmpxchg-org.20230601.gappssmtp.com header.b=IaJ+JOkD; arc=none smtp.client-ip=209.85.222.175 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=cmpxchg.org Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=cmpxchg.org Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=cmpxchg-org.20230601.gappssmtp.com header.i=@cmpxchg-org.20230601.gappssmtp.com header.b="IaJ+JOkD" Received: by mail-qk1-f175.google.com with SMTP id af79cd13be357-7b6ed9ed5b9so268691385a.2 for ; Fri, 17 Jan 2025 08:56:17 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=cmpxchg-org.20230601.gappssmtp.com; s=20230601; t=1737132977; x=1737737777; darn=vger.kernel.org; h=in-reply-to:content-disposition:mime-version:references:message-id :subject:cc:to:from:date:from:to:cc:subject:date:message-id:reply-to; bh=ghbAvzlR6mk62PxWv6MFBehOgd27WJTfHwfhEljUO9k=; b=IaJ+JOkDYEkZk209bzt1Zvv8u2V1Ys28Vu4hUAnF6+hwcIJL/ArR3AL3I9wAOWSgWo Eg6NZ9gnu/0s7PWPNuAU6zHcgYlYS8g1VIa1VS5pkTUvjkuOqzoSTTusJw2ELSpXYiJC NmcslDfp6HD7wkDmOD+oLNFlwYsVON1YhqgwYWFeSOuwrhfq3M0OnoCy9+DmSM0hJ6XI R6DxNpIjne4ZE2vTh3y73UQb1f/03+vjw8D8eWx8acBt0pMRgjdgxtWOEm1MLORzWPIF cBmmqfIquJHrXgY+vcIfYGArYmJ+ZUKsRntb6DE869SKg527sM8QWlIewH4uzuYV37Q0 kpUA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1737132977; x=1737737777; h=in-reply-to:content-disposition:mime-version:references:message-id :subject:cc:to:from:date:x-gm-message-state:from:to:cc:subject:date :message-id:reply-to; bh=ghbAvzlR6mk62PxWv6MFBehOgd27WJTfHwfhEljUO9k=; b=G7d6MdVbA6X8hftzmkR7CqWVHxhYkujxI1zpVcgShpjxrWYdFjYsXVSkftvPXYPs2z GthDtjRD7YVXmPFQkTEZY6qk8dsnzHjfjQtMrMxsFLMNSsQSmsgSg9KE6aHkURMW5fdM Ib/YcbHEmjOqXgHCa35l/OcvRRCRSaSgsf1kEb2qLeyP588h+gTpxK/e95erGRrMvK3n kQgNsH5Kgt5S9IyZD27G9X7wICa7vtAqwfX+3VIKIXF1pUv79YWD+TfaxogOVOuUFjqS 5FS1yz8wM1ZEKuNWORSjVaDwGwzzfOGoGi9BllJJxxQo0W3f6ZniKBCjf5CUYRt7gztf m7XA== X-Forwarded-Encrypted: i=1; AJvYcCVwPKoiqyU/q41iTycITqqvf8pmxb07H77b+6G+sa1iuT9+qrSsE+zhAGhIbzomKnwdx+w8XKykBUyr6GA=@vger.kernel.org X-Gm-Message-State: AOJu0YzdlEOW/rMs5X9CU0gwtdAtPJWN2D6HhlvbyaTzFQBstrByApMb E8pwoZ2RijtKlKf5Bxqi3KFUFm4ELUHPXEgDTy6tG6uFCS9FbOAnwgndJxnM2ZM= X-Gm-Gg: ASbGnctW4gbZPohi7J3IChpLn0VAhE3wgOMoqSAhIOfTTZVoxgMb7Lxupb8Xn7POfln 3dTddjTC+rHzJk6+sbV8UZ4teX6/JJPtEXAvWTZSZuHQxmdKFWNz5f2iLGFax3v/1o3E6bXB4WG ZhQQ2HN7lQd44cx8Hs8I1N75Es0aplAjuy1iPX3uKzNkWOWJdMtWh3PBAv+QDe/Axz4ITWWw9kV iGZtmYuYf+dRXSziRWaJGk1axerPwSz2AMPcp9ELl8elglszwNzd3M= X-Google-Smtp-Source: AGHT+IGlnTKX/0q5IbCtm50o6MEMkk7zw+6qINZ8d+hjttdZmOyoqXGdPKCXxLM1GFu2wStmxZ0MTw== X-Received: by 2002:a05:620a:4142:b0:7b6:6e59:2864 with SMTP id af79cd13be357-7be6324fc1cmr571824785a.43.1737132976849; Fri, 17 Jan 2025 08:56:16 -0800 (PST) Received: from localhost ([2603:7000:c01:2716:f0c4:bf28:3737:7c34]) by smtp.gmail.com with UTF8SMTPSA id 6a1803df08f44-6e1afc33cacsm12950386d6.66.2025.01.17.08.56.15 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 17 Jan 2025 08:56:15 -0800 (PST) Date: Fri, 17 Jan 2025 11:56:15 -0500 From: Johannes Weiner To: Chen Ridong Cc: akpm@linux-foundation.org, mhocko@kernel.org, yosryahmed@google.com, roman.gushchin@linux.dev, shakeel.butt@linux.dev, muchun.song@linux.dev, davidf@vimeo.com, vbabka@suse.cz, mkoutny@suse.com, linux-mm@kvack.org, linux-kernel@vger.kernel.org, cgroups@vger.kernel.org, chenridong@huawei.com, wangweiyang2@huawei.com Subject: Re: [PATCH v3 next 4/5] memcg: factor out stat(event)/stat_local(event_local) reading functions Message-ID: <20250117165615.GF182896@cmpxchg.org> References: <20250117014645.1673127-1-chenridong@huaweicloud.com> <20250117014645.1673127-5-chenridong@huaweicloud.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20250117014645.1673127-5-chenridong@huaweicloud.com> On Fri, Jan 17, 2025 at 01:46:44AM +0000, Chen Ridong wrote: > From: Chen Ridong > > The only difference between 'lruvec_page_state' and > 'lruvec_page_state_local' is that they read 'state' and 'state_local', > respectively. Factor out an inner functions to make the code more concise. > Do the same for reading 'memcg_page_stat' and 'memcg_events'. > > Signed-off-by: Chen Ridong bool parameters make for poor readability at the callsites :( With the next patch moving most of the duplication to memcontrol-v1.c, I think it's probably not worth refactoring this.