public inbox for cgroups@vger.kernel.org
 help / color / mirror / Atom feed
From: "Michal Koutný" <mkoutny-IBi9RG/b67k@public.gmane.org>
To: Tejun Heo <tj-DgEjT+Ai2ygdnm+yROfE0A@public.gmane.org>
Cc: Zefan Li <lizefan.x-EC8Uxl6Npydl57MIdRCFDg@public.gmane.org>,
	Johannes Weiner <hannes-druUgvl0LCNAfugRpC6u6w@public.gmane.org>,
	cgroups-u79uwXL29TY76Z2rM5mHXA@public.gmane.org,
	kernel-team-b10kYP2dOMg@public.gmane.org
Subject: Re: [PATCH 1/2 cgroup/for-6.1] cgroup: Improve cftype add/rm error handling
Date: Tue, 6 Sep 2022 21:11:12 +0200	[thread overview]
Message-ID: <20220906191112.GF30763@blackbody.suse.cz> (raw)
In-Reply-To: <YxeCdHfk2nOUISDw-NiLfg/pYEd1N0TnZuCh8vA@public.gmane.org>

[-- Attachment #1: Type: text/plain, Size: 1726 bytes --]

On Tue, Sep 06, 2022 at 07:25:08AM -1000, Tejun Heo <tj-DgEjT+Ai2ygdnm+yROfE0A@public.gmane.org> wrote:
> I prefer having it as a separate flag because it's explicit and can be
> tested together with other flags. It's a weak preference tho and I can go
> either way if it bothers you much.

No trouble, please proceed with the new flag.

BTW, while I was just looking over the patch I noticed that in

@@ -1717,14 +1722,22 @@ static int css_populate_dir(struct cgrou
                return 0;

        if (!css->ss) {
-               if (cgroup_on_dfl(cgrp))
-                       cfts = cgroup_base_files;
-               else
-                       cfts = cgroup1_base_files;
-
-               ret = cgroup_addrm_files(&cgrp->self, cgrp, cfts, true);
-               if (ret < 0)
-                       return ret;
+               if (cgroup_on_dfl(cgrp)) {
+                       ret = cgroup_addrm_files(&cgrp->self, cgrp,
+                                                cgroup_base_files, true);
+                       if (ret < 0)
+                               return ret;
+
+                       if (cgroup_psi_enabled()) {
+                               ret = cgroup_addrm_files(&cgrp->self, cgrp,
+                                                        cgroup_psi_files, true);
+                               if (ret < 0)
+                                       return ret;

Before the return here, the function should revert the base files first (or
silence the return value to 0 if such a partial population is acceptable).

(Actually, it looks like the revert in the subsys branch is unnecessary as
callers of css_populate_dir() would issue css_clear_dir() upon failure
eventually.)


Thanks,
Michal

[-- Attachment #2: Digital signature --]
[-- Type: application/pgp-signature, Size: 228 bytes --]

  parent reply	other threads:[~2022-09-06 19:11 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-09-04 21:09 [PATCH 1/2 cgroup/for-6.1] cgroup: Improve cftype add/rm error handling Tejun Heo
     [not found] ` <YxUUISLVLEIRBwEY-NiLfg/pYEd1N0TnZuCh8vA@public.gmane.org>
2022-09-04 21:10   ` [PATCH 2/2 cgroup/for-6.1] cgroup: Remove CFTYPE_PRESSURE Tejun Heo
2022-09-05 13:14   ` [PATCH 1/2 cgroup/for-6.1] cgroup: Improve cftype add/rm error handling Michal Koutný
     [not found]     ` <20220905131435.GA1765-9OudH3eul5jcvrawFnH+a6VXKuFTiq87@public.gmane.org>
2022-09-06 17:25       ` Tejun Heo
     [not found]         ` <YxeCdHfk2nOUISDw-NiLfg/pYEd1N0TnZuCh8vA@public.gmane.org>
2022-09-06 19:11           ` Michal Koutný [this message]
     [not found]             ` <20220906191112.GF30763-9OudH3eul5jcvrawFnH+a6VXKuFTiq87@public.gmane.org>
2022-09-06 19:37               ` Tejun Heo
2022-09-06 19:39   ` Tejun Heo

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=20220906191112.GF30763@blackbody.suse.cz \
    --to=mkoutny-ibi9rg/b67k@public.gmane.org \
    --cc=cgroups-u79uwXL29TY76Z2rM5mHXA@public.gmane.org \
    --cc=hannes-druUgvl0LCNAfugRpC6u6w@public.gmane.org \
    --cc=kernel-team-b10kYP2dOMg@public.gmane.org \
    --cc=lizefan.x-EC8Uxl6Npydl57MIdRCFDg@public.gmane.org \
    --cc=tj-DgEjT+Ai2ygdnm+yROfE0A@public.gmane.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