Re: [PATCH v2] sched, timer: Use atomics for thread_group_cputimer to improve scalability

From: Jason Low
Date: Mon Mar 02 2015 - 16:49:58 EST


On Mon, 2015-03-02 at 11:03 -0800, Linus Torvalds wrote:
> On Mon, Mar 2, 2015 at 10:42 AM, Jason Low <jason.low2@xxxxxx> wrote:
> >
> > This patch converts the timers to 64 bit atomic variables and use
> > atomic add to update them without a lock. With this patch, the percent
> > of total time spent updating thread group cputimer timers was reduced
> > from 30% down to less than 1%.
>
> NAK.
>
> Not because I think this is wrong, but because somebody needs to look
> at the effects on 32-bit architectures too.
>
> In particular, check out lib/atomic64.c - which uses a hashed array of
> 16-bit spinlocks to do 64-bit atomics. That may or may well work ok in
> practice, but it does mean that now sample_group_cputimer() and
> update_gt_cputime() will take that (it ends up generally being the
> same) spinlock three times for the three atomic64_read()'s.

Okay, I will run some tests to see how this change affects the
performance of itimers on 32 bit systems.

While the update_gt_cputime() shouldn't be an issue for performance
since it doesn't get called often, the sample_group_cputimer() needing
to take locks 3 times for each atomic64_read is something that could
impact performance, so we should take a look at that.

Thanks,
Jason

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/