Re: [PATCH v10 2/5] sched: CGroup tagging interface for core scheduling

2021-03-01 Thread Josh Don
On Fri, Feb 26, 2021 at 12:08 PM Chris Hyser wrote: > > Update: > > The clone syscall stress test I have is causing a deadlock with this patchset > when > compiled with CONFIG_PROVE_RAW_LOCK_NESTING=y. I am able to get stacktraces > with > nmi_watchdog and am looking through those. Josh was not

Re: [PATCH v10 2/5] sched: CGroup tagging interface for core scheduling

2021-02-26 Thread Chris Hyser
On 2/24/21 10:47 AM, chris hyser wrote: On 2/24/21 8:52 AM, chris hyser wrote: On 2/24/21 8:02 AM, Chris Hyser wrote: However, it means that overall throughput of your binary is cut in ~half, since none of the threads can share a core. Note that I never saw an indefinite deadlock, just ~2x run

Re: [PATCH v10 2/5] sched: CGroup tagging interface for core scheduling

2021-02-24 Thread chris hyser
On 2/24/21 8:52 AM, chris hyser wrote: On 2/24/21 8:02 AM, Chris Hyser wrote: However, it means that overall throughput of your binary is cut in ~half, since none of the threads can share a core. Note that I never saw an indefinite deadlock, just ~2x runtime for your binary vs th > control. I'v

Re: [PATCH v10 2/5] sched: CGroup tagging interface for core scheduling

2021-02-24 Thread chris hyser
On 2/24/21 8:02 AM, Chris Hyser wrote: However, it means that overall throughput of your binary is cut in ~half, since none of the threads can share a core. Note that I never saw an indefinite deadlock, just ~2x runtime for your binary vs th > control. I've verified that both a) manually hardco

Re: [PATCH v10 2/5] sched: CGroup tagging interface for core scheduling

2021-02-24 Thread Chris Hyser
On 2/24/21 12:15 AM, Josh Don wrote: On Tue, Feb 23, 2021 at 11:26 AM Chris Hyser wrote: On 2/23/21 4:05 AM, Peter Zijlstra wrote: On Mon, Feb 22, 2021 at 11:00:37PM -0500, Chris Hyser wrote: On 1/22/21 8:17 PM, Joel Fernandes (Google) wrote: While trying to test the new prctl() code I'm

Re: [PATCH v10 2/5] sched: CGroup tagging interface for core scheduling

2021-02-23 Thread Josh Don
On Tue, Feb 23, 2021 at 11:26 AM Chris Hyser wrote: > > On 2/23/21 4:05 AM, Peter Zijlstra wrote: > > On Mon, Feb 22, 2021 at 11:00:37PM -0500, Chris Hyser wrote: > >> On 1/22/21 8:17 PM, Joel Fernandes (Google) wrote: > >> While trying to test the new prctl() code I'm working on, I ran into a bug

Re: [PATCH v10 2/5] sched: CGroup tagging interface for core scheduling

2021-02-23 Thread Chris Hyser
On 2/23/21 4:05 AM, Peter Zijlstra wrote: On Mon, Feb 22, 2021 at 11:00:37PM -0500, Chris Hyser wrote: On 1/22/21 8:17 PM, Joel Fernandes (Google) wrote: While trying to test the new prctl() code I'm working on, I ran into a bug I chased back into this v10 code. Under a fair amount of stress, wh

Re: [PATCH v10 2/5] sched: CGroup tagging interface for core scheduling

2021-02-23 Thread Peter Zijlstra
On Mon, Feb 22, 2021 at 11:00:37PM -0500, Chris Hyser wrote: > On 1/22/21 8:17 PM, Joel Fernandes (Google) wrote: > While trying to test the new prctl() code I'm working on, I ran into a bug I > chased back into this v10 code. Under a fair amount of stress, when the > function __sched_core_update_c

Re: [PATCH v10 2/5] sched: CGroup tagging interface for core scheduling

2021-02-22 Thread Chris Hyser
On 1/22/21 8:17 PM, Joel Fernandes (Google) wrote: +static void __sched_core_update_cookie(struct task_struct *p) +{ + struct rb_node *parent, **node; + struct sched_core_cookie *node_core_cookie, *match; + static const struct sched_core_cookie zero_cookie; + struct sched_

Re: [PATCH v10 2/5] sched: CGroup tagging interface for core scheduling

2021-02-05 Thread Chris Hyser
On 2/5/21 5:43 AM, Peter Zijlstra wrote: On Thu, Feb 04, 2021 at 03:52:55PM -0500, Chris Hyser wrote: A second complication was a decision that new processes (not threads) do not inherit their parents cookie. Thus forking is also not a means to share a cookie. Basically with a "from-only" inter

Re: [PATCH v10 2/5] sched: CGroup tagging interface for core scheduling

2021-02-05 Thread Josh Don
On Fri, Feb 5, 2021 at 3:53 AM Peter Zijlstra wrote: > > On Fri, Jan 22, 2021 at 08:17:01PM -0500, Joel Fernandes (Google) wrote: > > > +/* All active sched_core_cookies */ > > +static struct rb_root sched_core_cookies = RB_ROOT; > > +static DEFINE_RAW_SPINLOCK(sched_core_cookies_lock); > > > +/*

Re: [PATCH v10 2/5] sched: CGroup tagging interface for core scheduling

2021-02-05 Thread Joel Fernandes
On Thu, Feb 04, 2021 at 03:52:53PM +0100, Peter Zijlstra wrote: > On Fri, Jan 22, 2021 at 08:17:01PM -0500, Joel Fernandes (Google) wrote: > > +static void sched_core_update_cookie(struct task_struct *p, unsigned long > > cookie, > > +enum sched_core_cookie_type coo

Re: [PATCH v10 2/5] sched: CGroup tagging interface for core scheduling

2021-02-05 Thread Joel Fernandes
Hi Peter, On Thu, Feb 04, 2021 at 02:59:58PM +0100, Peter Zijlstra wrote: > On Wed, Feb 03, 2021 at 05:51:15PM +0100, Peter Zijlstra wrote: > > > > I'm slowly starting to go through this... > > > > On Fri, Jan 22, 2021 at 08:17:01PM -0500, Joel Fernandes (Google) wrote: > > > +static bool sched_

Re: [PATCH v10 2/5] sched: CGroup tagging interface for core scheduling

2021-02-05 Thread Peter Zijlstra
On Fri, Jan 22, 2021 at 08:17:01PM -0500, Joel Fernandes (Google) wrote: > +int sched_core_share_tasks(struct task_struct *t1, struct task_struct *t2) > +{ > + static DEFINE_MUTEX(sched_core_tasks_mutex); > + unsigned long cookie; > + int ret = -ENOMEM; > + > + mutex_lock(&sched_cor

Re: [PATCH v10 2/5] sched: CGroup tagging interface for core scheduling

2021-02-05 Thread Peter Zijlstra
On Fri, Jan 22, 2021 at 08:17:01PM -0500, Joel Fernandes (Google) wrote: > +/* All active sched_core_cookies */ > +static struct rb_root sched_core_cookies = RB_ROOT; > +static DEFINE_RAW_SPINLOCK(sched_core_cookies_lock); > +/* > + * Returns the following: > + * a < b => -1 > + * a == b => 0 >

Re: [PATCH v10 2/5] sched: CGroup tagging interface for core scheduling

2021-02-05 Thread Peter Zijlstra
On Fri, Jan 22, 2021 at 08:17:01PM -0500, Joel Fernandes (Google) wrote: > --- a/kernel/fork.c > +++ b/kernel/fork.c > @@ -736,6 +736,7 @@ void __put_task_struct(struct task_struct *tsk) > exit_creds(tsk); > delayacct_tsk_free(tsk); > put_signal_struct(tsk->signal); > + sched_

Re: [PATCH v10 2/5] sched: CGroup tagging interface for core scheduling

2021-02-05 Thread Peter Zijlstra
On Thu, Feb 04, 2021 at 03:52:55PM -0500, Chris Hyser wrote: > A second complication was a decision that new processes (not threads) do not > inherit their parents cookie. Thus forking is also not a means to share a > cookie. Basically with a "from-only" interface, the new task would need to > be

Re: [PATCH v10 2/5] sched: CGroup tagging interface for core scheduling

2021-02-04 Thread Josh Don
On Thu, Feb 4, 2021 at 6:36 AM Peter Zijlstra wrote: > > refcount_dec_and_lock() avoids that complication. There isn't currently an interface for raw_spin_locks. Certainly could add a new interface in a separate patch as part of this series, but doesn't seem that bad to do the locking inline.

Re: [PATCH v10 2/5] sched: CGroup tagging interface for core scheduling

2021-02-04 Thread Josh Don
On Thu, Feb 4, 2021 at 6:02 AM Peter Zijlstra wrote: > > On Fri, Jan 22, 2021 at 08:17:01PM -0500, Joel Fernandes (Google) wrote: > > > +#ifdef CONFIG_SCHED_DEBUG > > + /* Read the group cookie. */ > > + { > > + .name = "core_group_cookie", > > + .flags = CFTYPE_NOT

Re: [PATCH v10 2/5] sched: CGroup tagging interface for core scheduling

2021-02-04 Thread Josh Don
On Thu, Feb 4, 2021 at 5:54 AM Peter Zijlstra wrote: > > On Fri, Jan 22, 2021 at 08:17:01PM -0500, Joel Fernandes (Google) wrote: > > From: Peter Zijlstra > > I'm thinking this is too much credit, I didn't write much of this. > > > Marks all tasks in a cgroup as matching for core-scheduling. > >

Re: [PATCH v10 2/5] sched: CGroup tagging interface for core scheduling

2021-02-04 Thread Chris Hyser
On 2/4/21 8:57 AM, Peter Zijlstra wrote: On Fri, Jan 22, 2021 at 08:17:01PM -0500, Joel Fernandes (Google) wrote: +/* Request the scheduler to share a core */ +#define PR_SCHED_CORE_SHARE59 +# define PR_SCHED_CORE_CLEAR 0 /* clear core_sched cookie of pid */ +# define PR_S

Re: [PATCH v10 2/5] sched: CGroup tagging interface for core scheduling

2021-02-04 Thread Peter Zijlstra
On Fri, Jan 22, 2021 at 08:17:01PM -0500, Joel Fernandes (Google) wrote: > +static void sched_core_update_cookie(struct task_struct *p, unsigned long > cookie, > + enum sched_core_cookie_type cookie_type) > +{ > + struct rq_flags rf; > + struct rq *rq; > +

Re: [PATCH v10 2/5] sched: CGroup tagging interface for core scheduling

2021-02-04 Thread Peter Zijlstra
On Fri, Jan 22, 2021 at 08:17:01PM -0500, Joel Fernandes (Google) wrote: > +static inline void __sched_core_erase_cookie(struct sched_core_cookie > *cookie) > +{ > + lockdep_assert_held(&sched_core_cookies_lock); > + > + /* Already removed */ > + if (RB_EMPTY_NODE(&cookie->node)) > +

Re: [PATCH v10 2/5] sched: CGroup tagging interface for core scheduling

2021-02-04 Thread Peter Zijlstra
On Fri, Jan 22, 2021 at 08:17:01PM -0500, Joel Fernandes (Google) wrote: > +#ifdef CONFIG_SCHED_DEBUG > + /* Read the group cookie. */ > + { > + .name = "core_group_cookie", > + .flags = CFTYPE_NOT_ON_ROOT, > + .read_u64 = cpu_core_group_cookie_read_u64,

Re: [PATCH v10 2/5] sched: CGroup tagging interface for core scheduling

2021-02-04 Thread Peter Zijlstra
On Wed, Feb 03, 2021 at 05:51:15PM +0100, Peter Zijlstra wrote: > > I'm slowly starting to go through this... > > On Fri, Jan 22, 2021 at 08:17:01PM -0500, Joel Fernandes (Google) wrote: > > +static bool sched_core_empty(struct rq *rq) > > +{ > > + return RB_EMPTY_ROOT(&rq->core_tree); > > +} >

Re: [PATCH v10 2/5] sched: CGroup tagging interface for core scheduling

2021-02-04 Thread Peter Zijlstra
On Fri, Jan 22, 2021 at 08:17:01PM -0500, Joel Fernandes (Google) wrote: > +/* Request the scheduler to share a core */ > +#define PR_SCHED_CORE_SHARE 59 > +# define PR_SCHED_CORE_CLEAR 0 /* clear core_sched cookie of pid */ > +# define PR_SCHED_CORE_SHARE_FROM1 /* get core_s

Re: [PATCH v10 2/5] sched: CGroup tagging interface for core scheduling

2021-02-04 Thread Peter Zijlstra
On Fri, Jan 22, 2021 at 08:17:01PM -0500, Joel Fernandes (Google) wrote: > From: Peter Zijlstra I'm thinking this is too much credit, I didn't write much of this. > Marks all tasks in a cgroup as matching for core-scheduling. > > A task will need to be moved into the core scheduler queue when t

Re: [PATCH v10 2/5] sched: CGroup tagging interface for core scheduling

2021-02-03 Thread Peter Zijlstra
I'm slowly starting to go through this... On Fri, Jan 22, 2021 at 08:17:01PM -0500, Joel Fernandes (Google) wrote: > +static bool sched_core_empty(struct rq *rq) > +{ > + return RB_EMPTY_ROOT(&rq->core_tree); > +} > + > +static struct task_struct *sched_core_first(struct rq *rq) > +{ > +

[PATCH v10 2/5] sched: CGroup tagging interface for core scheduling

2021-01-22 Thread Joel Fernandes (Google)
From: Peter Zijlstra Marks all tasks in a cgroup as matching for core-scheduling. A task will need to be moved into the core scheduler queue when the cgroup it belongs to is tagged to run with core scheduling. Similarly the task will need to be moved out of the core scheduler queue when the cgr