All of lore.kernel.org
 help / color / mirror / Atom feed
From: Tejun Heo <tj@kernel.org>
To: Shaohua Li <shli@kernel.org>
Cc: linux-kernel@vger.kernel.org, linux-block@vger.kernel.org,
	lizefan@huawei.com, tglx@linutronix.de, kernel-team@fb.com,
	axboe@kernel.dk, Shaohua Li <shli@fb.com>
Subject: Re: [PATCH 1/3] kthread: add a mechanism to store cgroup info
Date: Fri, 8 Sep 2017 07:35:37 -0700	[thread overview]
Message-ID: <20170908143537.GW1774378@devbig577.frc2.facebook.com> (raw)
In-Reply-To: <9d25e5bed5ef2fad5f8a817e293f0d93e3b329c2.1504748195.git.shli@fb.com>

Hello,

On Wed, Sep 06, 2017 at 07:00:51PM -0700, Shaohua Li wrote:
> +#ifdef CONFIG_CGROUPS
> +void kthread_set_orig_css(struct cgroup_subsys_state *css);
> +struct cgroup_subsys_state *kthread_get_orig_css(void);
> +void kthread_reset_orig_css(void);

* It's a bit weird to associate a kthread with a css without being
  specific.  If what's needed is a generic association (this kthread
  is temporarily servicing this cgroup), it should be associated with
  the cgroup.  But, I think it'd be better to make it specific instead
  - ie. kthread_set_io_css().

* Do we need the reset function to be separate?  Can't we just clear
  it when the set function is called with NULL css?

* For the accessor, can we do sth like kthread_orig_css() (or
  kthread_io_css())?  "get" is overloaded between set/get and get/put,
  so it can get confusing.

> diff --git a/include/linux/sched.h b/include/linux/sched.h
> index c05ac5f..ab2295d 100644
> --- a/include/linux/sched.h
> +++ b/include/linux/sched.h
> @@ -1276,6 +1276,7 @@ extern struct pid *cad_pid;
>  #define PF_SWAPWRITE		0x00800000	/* Allowed to write to swap */
>  #define PF_NO_SETAFFINITY	0x04000000	/* Userland is not allowed to meddle with cpus_allowed */
>  #define PF_MCE_EARLY		0x08000000      /* Early kill for mce process policy */
> +#define PF_KTHREAD_HAS_CSS	0x10000000	/* kthread has css info attached */

Do we need a separate flag for this?  kthreads already have PF_KTHREAD
set.  I'm not sure why we'd need another flag.  Once we know it's a
kthread, we can just access its css pointer field, right?

Thanks.

-- 
tejun

  reply	other threads:[~2017-09-08 14:35 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-09-07  2:00 [PATCH 0/3] block: make loop block device cgroup aware Shaohua Li
2017-09-07  2:00 ` [PATCH 1/3] kthread: add a mechanism to store cgroup info Shaohua Li
2017-09-08 14:35   ` Tejun Heo [this message]
2017-09-08 14:38     ` Tejun Heo
2017-09-08 14:40       ` Tejun Heo
2017-09-08 16:51     ` Shaohua Li
2017-09-07  2:00 ` [PATCH 2/3] block: make blkcg aware of kthread stored original " Shaohua Li
2017-09-08 14:41   ` Tejun Heo
2017-09-07  2:00 ` [PATCH 3/3] block/loop: make loop cgroup aware Shaohua Li
2017-09-08 14:48   ` Tejun Heo
2017-09-08 17:07     ` Shaohua Li
2017-09-08 17:54       ` 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=20170908143537.GW1774378@devbig577.frc2.facebook.com \
    --to=tj@kernel.org \
    --cc=axboe@kernel.dk \
    --cc=kernel-team@fb.com \
    --cc=linux-block@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=lizefan@huawei.com \
    --cc=shli@fb.com \
    --cc=shli@kernel.org \
    --cc=tglx@linutronix.de \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.