Messages in this thread | | | From | John Stultz <> | Date | Thu, 9 Nov 2023 19:45:14 -0800 | Subject | Re: [PATCH v6 18/20] sched: Handle blocked-waiter migration (and return migration) |
| |
On Wed, Nov 8, 2023 at 10:38 PM Xuewen Yan <xuewen.yan94@gmail.com> wrote: > On Thu, Nov 9, 2023 at 2:08 PM John Stultz <jstultz@google.com> wrote: > > I'm currently trying to see if I can extend the blocked_on_waking flag > > to keep more state (BLOCKED, WAKING, RUNNABLE) so that we can move the > > return migration back to the the try_to_wake_up() call path, while > > avoiding the task from becoming suddenly runnable on wakeup while on > > the wrong runqueue. This would avoid the lock juggling as we'd > > already have the pi_lock. Though I'm a little hesitant as doing the > > deactivate()/select_task_rq()/activate() steps from ttwu might muddle > > up the careful logic around the on_rq/ttwu_runnable checks (definitely > > had issues in that area with earlier versions of the patch). > > I also think it is better to put the return migration back to the > try_to_wake_up() call path. > When mutex_unlock, could we deactivate the block task before adding it > to wake_q?
That's an interesting idea. Let me give that a shot and see if it works out better.
> In this case, it can follow the try_to_wake_up patch. But at this > time, the trace_sched_blocked_reason > may be no need? > > > > > > In addition, I also thought that since the block task is no longer > > > dequeued, this will definitely cause the load on the CPU to increase. > > > Perhaps we need to evaluate the impact of this on power consumption. > > > > > > > Yeah. I've got that still as a todo in the cover letter: > > * CFS load balancing. Blocked tasks may carry forward load (PELT) > > to the lock owner's CPU, so CPU may look like it is overloaded. > > > > If you have any thoughts there for a preferred approach, I'd be happy to hear. > > Okay, I'm still studying these patches carefully, and I will to test > these patches later. When I find other problems, I will be happy to > share.
Very much appreciated! Thank you again for the feedback and thoughts! -john
| |