Re: [patch 15/44] posix-cpu-timer: Comsolidate thread group sample code
From: Ingo Molnar
Date: Mon Aug 19 2019 - 15:07:51 EST
in the title:
* Thomas Gleixner <tglx@xxxxxxxxxxxxx> wrote:
> cpu_clock_sample_group() and cpu_timer_sample_group() are almost the
> same. Before the rename one called thread_group_cputimer() and the other
> thread_group_cputime(). Really intuitive function names.
> Consolidate the functions and also avoid the thread traversal when
> the thread group accounting is already active.
> Signed-off-by: Thomas Gleixner <tglx@xxxxxxxxxxxxx>
> kernel/time/posix-cpu-timers.c | 59 +++++++++++++----------------------------
> 1 file changed, 20 insertions(+), 39 deletions(-)
> --- a/kernel/time/posix-cpu-timers.c
> +++ b/kernel/time/posix-cpu-timers.c
> @@ -294,29 +294,37 @@ thread_group_start_cputime(struct task_s
> - * Sample a process (thread group) clock for the given group_leader task.
> - * Must be called with task sighand lock held for safe while_each_thread()
> - * traversal.
> + * Sample a process (thread group) clock for the given task clkid. If the
> + * groups cputime accounting is already enabled, read the atomic
> + * store. Otherwise a full update is required. task sighand lock must be
> + * held to protect the task traversal on a full update.