linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
From: Waiman Long <llong@redhat.com>
To: Gregory Price <gourry@gourry.net>, Waiman Long <llong@redhat.com>
Cc: cgroups@vger.kernel.org, linux-mm@kvack.org,
	linux-kernel@vger.kernel.org, kernel-team@meta.com,
	tj@kernel.org, hannes@cmpxchg.org, mkoutny@suse.com,
	mhocko@kernel.org, roman.gushchin@linux.dev,
	shakeel.butt@linux.dev, muchun.song@linux.dev,
	akpm@linux-foundation.org
Subject: Re: [PATCH v2 2/2] vmscan,cgroup: apply mems_effective to reclaim
Date: Fri, 18 Apr 2025 23:53:26 -0400	[thread overview]
Message-ID: <19e268b0-b6d5-4aab-a4d0-cd1102027f3d@redhat.com> (raw)
In-Reply-To: <aAMc0ux6_jEhEskd@gourry-fedora-PF4VCD3F>


On 4/18/25 11:47 PM, Gregory Price wrote:
> On Fri, Apr 18, 2025 at 10:06:40PM -0400, Waiman Long 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);
>>> +	/* At least one parent must have a valid node list */
>>> +	while (nodes_empty(cs->effective_mems))
>>> +		cs = parent_cs(cs);
>> For cgroup v2, effective_mems should always be set and walking up the tree
>> isn't necessary. For v1, it can be empty, but memory cgroup and cpuset are
>> unlikely in the same hierarchy.
>>
> Hm, do i need different paths here for v1 vs v2 then?  Or is it
> sufficient to simply return true if effective_mems is empty (which
> implies v1)?

Yes, you can return true if it happens to be empty, but it is 
"unlikely". In v1,cpuset and memory cgroup are in separate hierarchies 
AFAIU. So the cgroup you pass into cpuset_node_allowed() won't have a 
matching cpuset.

Cheers,
Longman

> Thanks,
> ~Gregory
>



  reply	other threads:[~2025-04-19  3:53 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-04-18  3:13 [PATCH 1/2] cpuset: rename cpuset_node_allowed to cpuset_current_node_allowed Gregory Price
2025-04-18  3:13 ` [PATCH v2 2/2] vmscan,cgroup: apply mems_effective to reclaim Gregory Price
2025-04-19  2:06   ` Waiman Long
2025-04-19  3:47     ` Gregory Price
2025-04-19  3:53       ` Waiman Long [this message]
2025-04-19  3:06   ` Tejun Heo
2025-04-19  3:27     ` Gregory Price
2025-04-19  3:41       ` Gregory Price
2025-04-19  3:47       ` Waiman Long
2025-04-19  1:59 ` [PATCH 1/2] cpuset: rename cpuset_node_allowed to cpuset_current_node_allowed Waiman Long

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=19e268b0-b6d5-4aab-a4d0-cd1102027f3d@redhat.com \
    --to=llong@redhat.com \
    --cc=akpm@linux-foundation.org \
    --cc=cgroups@vger.kernel.org \
    --cc=gourry@gourry.net \
    --cc=hannes@cmpxchg.org \
    --cc=kernel-team@meta.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mm@kvack.org \
    --cc=mhocko@kernel.org \
    --cc=mkoutny@suse.com \
    --cc=muchun.song@linux.dev \
    --cc=roman.gushchin@linux.dev \
    --cc=shakeel.butt@linux.dev \
    --cc=tj@kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox