From mboxrd@z Thu Jan 1 00:00:00 1970 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 83F06C369AB for ; Mon, 21 Apr 2025 23:16:04 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 875976B0005; Mon, 21 Apr 2025 19:16:01 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 7FC496B0007; Mon, 21 Apr 2025 19:16:01 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 6C2A66B0008; Mon, 21 Apr 2025 19:16:01 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0012.hostedemail.com [216.40.44.12]) by kanga.kvack.org (Postfix) with ESMTP id 4DD3D6B0005 for ; Mon, 21 Apr 2025 19:16:01 -0400 (EDT) Received: from smtpin29.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay06.hostedemail.com (Postfix) with ESMTP id 2DE54BFA10 for ; Mon, 21 Apr 2025 23:16:03 +0000 (UTC) X-FDA: 83359611006.29.D219D42 Received: from out-181.mta0.migadu.com (out-181.mta0.migadu.com [91.218.175.181]) by imf14.hostedemail.com (Postfix) with ESMTP id 3FE0A100006 for ; Mon, 21 Apr 2025 23:16:01 +0000 (UTC) Authentication-Results: imf14.hostedemail.com; dkim=pass header.d=linux.dev header.s=key1 header.b=faZh5Iol; dmarc=pass (policy=none) header.from=linux.dev; spf=pass (imf14.hostedemail.com: domain of shakeel.butt@linux.dev designates 91.218.175.181 as permitted sender) smtp.mailfrom=shakeel.butt@linux.dev ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1745277361; a=rsa-sha256; cv=none; b=Dx7scO/jhR68A9Y2Mi3ApZYonrjk06QKei56X+fmHkbvtdtuD2ge2Bw7f6nW7zpRrx4Uy0 a+TygaZ9rsMOOelZ5/O5T1NIEV5TDy9xKJIRAJbeaqRZKfFX+Q/1YAlHSw1I2cba+Gh54H l2gKIZ1I4Eq6UBr6CBsmvJV0fokYdjA= ARC-Authentication-Results: i=1; imf14.hostedemail.com; dkim=pass header.d=linux.dev header.s=key1 header.b=faZh5Iol; dmarc=pass (policy=none) header.from=linux.dev; spf=pass (imf14.hostedemail.com: domain of shakeel.butt@linux.dev designates 91.218.175.181 as permitted sender) smtp.mailfrom=shakeel.butt@linux.dev ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1745277361; 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-type:content-transfer-encoding: in-reply-to:in-reply-to:references:references:dkim-signature; bh=bZwUUkF9o+QsLYIOwSMNxz5A0VLDrjRSGdE39s7vzJs=; b=qA0RoFt+HUUVCgywuK6s8iBq+w+1IdpdzF8bY6GIP39KG/d33gUREC0qO6cq+eyfRrjcVD EP2xsRrsoFbjKI8ZDJOP0WnlVIhI2Pq+ZMEXUOq8uSzffIvVgC9dv27ALwOrvNboQcnd1L Kza+cNqdvbB0BfevOfnguyTO69bJFFQ= Date: Mon, 21 Apr 2025 16:15:49 -0700 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linux.dev; s=key1; t=1745277359; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=bZwUUkF9o+QsLYIOwSMNxz5A0VLDrjRSGdE39s7vzJs=; b=faZh5IollC7WTz0K2Utiy4sK/V1yin7lw2JUPdXA3eD9q6Esv4XEmub7Ovecxt4jev6Ncr vxsvkchhi2Dwk5H9AjN1G3FKRMnWkde9fyjHDEe4UJe0jyNq0ZtpkkUctnWAO2HK7yARGq qLps1/bltMjndAo4aj9IbBII/fXbwRI= X-Report-Abuse: Please report any abuse attempt to abuse@migadu.com and include these headers. From: Shakeel Butt To: Gregory Price Cc: Waiman Long , linux-mm@kvack.org, cgroups@vger.kernel.org, linux-kernel@vger.kernel.org, kernel-team@meta.com, hannes@cmpxchg.org, mhocko@kernel.org, roman.gushchin@linux.dev, muchun.song@linux.dev, tj@kernel.org, mkoutny@suse.com, akpm@linux-foundation.org Subject: Re: [PATCH v3 2/2] vmscan,cgroup: apply mems_effective to reclaim Message-ID: References: <20250419053824.1601470-1-gourry@gourry.net> <20250419053824.1601470-3-gourry@gourry.net> <7dtp6v5evpz5sdevwrexhwcdtl5enczssvuepkib2oiaexk3oo@ranij7pskrhe> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: X-Migadu-Flow: FLOW_OUT X-Rspamd-Server: rspam03 X-Rspamd-Queue-Id: 3FE0A100006 X-Stat-Signature: 4kiqxin3e4yn3zq5b1nwe7zq4poex5qd X-Rspam-User: X-HE-Tag: 1745277361-166140 X-HE-Meta: U2FsdGVkX19+s4CebR422Nm5qfMwNxUBiZmFOgKXkEwNfAiHG4VdmqpflaPL9ePm6XGupRH/D3v1YGAxftj7fbhaxRAzqUq2j2/jMqjx2VnBk84ZxaaslaYwgpqG7nQiNmbRFuiX3LtWceotTfuFuHGD8q1AyDpFSnDwl+FVAms/hDfKn9jUbwZ0vpBpZxY0E4XVe0wPsPsy3F+lmUMX9lCwrMbJX0C5aVyqhtZQgA1OpqFM//ui7BOuzpeT/mNs4y7YdHWEmYjUotpHTA8/azQQ5tL+HIMfImwnTx3ThhLwt6Eixaps+rgqkhgOiiiCQA41sUaf6DCtUtZeEKSaFXM3sqjE1ppUMOpHfWjDJnnm0MaaHyoPKC0uM7iPD+nuFtsMsQzoyXMHwj+Bgy6csAJt1TcnNLHdxlkTCsozOkJftI1N24f0WO4yUZBzBVqHjMQAk3BwKIblS89GguPE719FxgFmtcgsunGjUUHTQBe25lR4+RLBrtk4LSV0cFcEnrPaTND2qcKYFiv9bD4+1cOuSMisRqQF/tUBgro0MjOLYd+xh9XunX+R0XipDLHSf4wLDDtPSaQtMQMYDB1G/ykP9rWY5OiMOVE0OS5vwa/pA+76BR+LEcY2feeKV8CR9V4nK14UvcGqKKdeImXolukGv6TzKI8mWYKbYPBFRAyogGkNbrWP3goeug/P4vVgfaVWx1VboKVxq+g3vyImNOdeNuopPk1XIUDdAI+UQMFH31fnVpOnB5x0Cy/fun6j1hVTIfxAJKHT0T86u1Hj1qH7U9KcKJKKsJeFmCgyAUxBTaEr1ip0jLWj+phbVZlygRvunrK7xOHrdmoQbgHd9yXTV+wCbBpOjRqqhFSbxL79RK1ATjVrTdJzZ3sVbJ09PsFu5G3SxE/fSlChs45XsSDKYdP7IkUtsHh2kZyRM5nSsuACxQQO/cti6LY/ZClcrcRJvN1RlgRbdOcZsxS HKxd1Xlq jQ6KKDjiWtwbfrl5SZh244UkFJ8p/DMCEHlwkcw5E+Tg0JIClMKpbGOfeUQW5kk2Cdk36f7qPgIzFuNcVcauzmKMzGuNYyxlalgParMUZMrMJ8J1QIS+K6/G2ZHyiTcL1YdEYylXCsPMRDRHEuau6P/rrvrcyXGkId+aX10CySChk6ngSln1w8ywbRkyXZnyu21wLqoVNdn7ZwY+p6xUDen3gYrct67oK4QWb5ZeygRmhQSU= 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: On Mon, Apr 21, 2025 at 06:59:20PM -0400, Gregory Price wrote: > On Mon, Apr 21, 2025 at 10:39:58AM -0700, Shakeel Butt wrote: > > On Sat, Apr 19, 2025 at 08:14:29PM -0400, Waiman Long wrote: > > > > > > On 4/19/25 2:48 PM, Shakeel Butt wrote: > > > > On Sat, Apr 19, 2025 at 01:38:24AM -0400, Gregory Price wrote: > > > > > +bool cpuset_node_allowed(struct cgroup *cgroup, int nid) > > > > > +{ > > > > > + struct cgroup_subsys_state *css; > > > > > + unsigned long flags; > > > > > + struct cpuset *cs; > > > > > + bool allowed; > > > > > + > > > > > + css = cgroup_get_e_css(cgroup, &cpuset_cgrp_subsys); > > > > > + if (!css) > > > > > + return true; > > > > > + > > > > > + cs = container_of(css, struct cpuset, css); > > > > > + spin_lock_irqsave(&callback_lock, flags); > > > > Do we really need callback_lock here? We are not modifying and I am > > > > wondering if simple rcu read lock is enough here (similar to > > > > update_nodemasks_hier() where parent's effective_mems is accessed within > > > > rcu read lock). > > > > > > The callback_lock is required to ensure the stability of the effective_mems > > > which may be in the process of being changed if not taken. > > > > Stability in what sense? effective_mems will not get freed under us > > here or is there a chance for corrupted read here? node_isset() and > > nodes_empty() seems atomic. What's the worst that can happen without > > callback_lock? > > Fairly sure nodes_empty is not atomic, it's a bitmap search. For bitmaps smaller than 64 bits, it seems atomic and MAX_NUMNODES seems smaller than 64 in all the archs. Anyways I am hoping that we can avoid taking a global lock in reclaim path which will become a source of contention for memory pressure situations.