lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Date:	Tue, 30 Jun 2015 17:23:56 +0300
From:	Frederic Weisbecker <fweisbec@...il.com>
To:	Rik van Riel <riel@...hat.com>
Cc:	LKML <linux-kernel@...r.kernel.org>,
	Frederic Weisbecker <fweisbec@...hat.com>,
	Peter Zijlstra <peterz@...radead.org>,
	Ingo Molnar <mingo@...nel.org>,
	Thomas Gleixner <tglx@...utronix.de>,
	Andy Lutomirski <luto@...capital.net>
Subject: Re: [RFC PATCH 08/11] nohz,timer: have housekeeper call
 account_process_tick for nohz cpus

2015-06-24 17:57 GMT+03:00  <riel@...hat.com>:
> From: Rik van Riel <riel@...hat.com>
>
> Have the housekeeper CPU call account_process_tick to do tick based
> accounting for remote nohz_full CPUs.
>
> Signed-off-by: Rik van Riel <riel@...hat.com>
> ---
>  kernel/time/timer.c | 28 ++++++++++++++++++++++++++++
>  1 file changed, 28 insertions(+)
>
> diff --git a/kernel/time/timer.c b/kernel/time/timer.c
> index 2ece3aa5069c..6adebb373317 100644
> --- a/kernel/time/timer.c
> +++ b/kernel/time/timer.c
> @@ -42,6 +42,7 @@
>  #include <linux/sched/sysctl.h>
>  #include <linux/slab.h>
>  #include <linux/compat.h>
> +#include "../sched/sched.h"
>
>  #include <asm/uaccess.h>
>  #include <asm/unistd.h>
> @@ -1382,6 +1383,29 @@ unsigned long get_next_timer_interrupt(unsigned long now)
>  }
>  #endif
>
> +#ifdef CONFIG_NO_HZ_FULL
> +static void account_remote_process_ticks(void)
> +{
> +       int cpu;
> +
> +       /*
> +        * The current task on another CPU can get rescheduled while
> +        * we are updating the statistics. The rcu read lock ensures
> +        * the task does not get freed, so at worst the statistics will
> +        * be off a little bit, which is expected with tick based sampling.
> +        */
> +       rcu_read_lock();
> +       for_each_cpu_and(cpu, tick_nohz_full_mask, cpu_online_mask) {
> +               struct task_struct *p = cpu_curr(cpu);
> +               int user_tick = (per_cpu(context_tracking.state, cpu) ==
> +                                       CONTEXT_USER);
> +
> +               account_process_tick(p, user_tick);
> +       }
> +       rcu_read_unlock();
> +}
> +#endif
> +
>  /*
>   * Called from the timer interrupt handler to charge one tick to the current
>   * process.  user_tick is 1 if the tick is user time, 0 for system.
> @@ -1392,6 +1416,10 @@ void update_process_times(int user_tick)
>
>         /* Note: this timer irq context must be accounted for as well. */
>         account_process_tick(p, user_tick);
> +#ifdef CONFIG_NO_HZ_FULL
> +       if (is_timer_housekeeping_cpu(smp_processor_id()))
> +               account_remote_process_ticks();
> +#endif

I like the idea overall. I just think that it should be done from a
process rather than an IRQ because the amount of CPUs to walk can be
high.

Perhaps a kthread? Or workqueue since we can now affine the unbound
ones to housekeepers.

Thanks.

>         run_local_timers();
>         rcu_check_callbacks(user_tick);
>  #ifdef CONFIG_IRQ_WORK
> --
> 2.1.0
>
> --
> To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
> the body of a message to majordomo@...r.kernel.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html
> Please read the FAQ at  http://www.tux.org/lkml/
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ