lkml.org 
[lkml]   [2018]   [Nov]   [20]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [PATCH 04/25] vtime: Spare a seqcount lock/unlock cycle on context switch
On Wed, Nov 14, 2018 at 03:45:48AM +0100, Frederic Weisbecker wrote:

So I definitely like avoiding that superfluous atomic op, however:

> @@ -730,19 +728,25 @@ static void vtime_account_guest(struct task_struct *tsk,
> }
> }
>
> +static void __vtime_account_kernel(struct task_struct *tsk,
> + struct vtime *vtime)

Your last patch removed a __function, and now you're adding one back :/

> {
> /* We might have scheduled out from guest path */
> if (tsk->flags & PF_VCPU)
> vtime_account_guest(tsk, vtime);
> else
> vtime_account_system(tsk, vtime);
> +}
> +
> +void vtime_account_kernel(struct task_struct *tsk)
> +{
> + struct vtime *vtime = &tsk->vtime;
> +
> + if (!vtime_delta(vtime))
> + return;
> +

See here the fast path (is it worth it?)

> + write_seqcount_begin(&vtime->seqcount);
> + __vtime_account_kernel(tsk, vtime);
> write_seqcount_end(&vtime->seqcount);
> }

> +void vtime_task_switch_generic(struct task_struct *prev)
> {
> struct vtime *vtime = &prev->vtime;

And observe a distinct lack of that same fast path..

>
> write_seqcount_begin(&vtime->seqcount);
> + if (is_idle_task(prev))
> + vtime_account_idle(prev);
> + else
> + __vtime_account_kernel(prev, vtime);
> vtime->state = VTIME_INACTIVE;
> write_seqcount_end(&vtime->seqcount);
>
> --
> 2.7.4
>

\
 
 \ /
  Last update: 2018-11-20 14:26    [W:0.135 / U:5.796 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site