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] [thread-next>] [day] [month] [year] [list]
Message-ID: <961aa3350807080444i4439ca33x3eee80113cd6a907@mail.gmail.com>
Date:	Tue, 8 Jul 2008 20:44:40 +0900
From:	"Akinobu Mita" <akinobu.mita@...il.com>
To:	"Rusty Russell" <rusty@...tcorp.com.au>
Cc:	linux-kernel@...r.kernel.org, "Jason Baron" <jbaron@...hat.com>,
	"Mathieu Desnoyers" <mathieu.desnoyers@...ymtl.ca>,
	"Max Krasnyansky" <maxk@...lcomm.com>,
	"Hidetoshi Seto" <seto.hidetoshi@...fujitsu.com>
Subject: Re: [PATCH 2/3] stop_machine: simplify

I found a small possible cleanup in this patch.

> diff --git a/kernel/cpu.c b/kernel/cpu.c
> --- a/kernel/cpu.c
> +++ b/kernel/cpu.c
> @@ -192,7 +192,6 @@ static int __ref _cpu_down(unsigned int
>  static int __ref _cpu_down(unsigned int cpu, int tasks_frozen)
>  {
>        int err, nr_calls = 0;
> -       struct task_struct *p;
>        cpumask_t old_allowed, tmp;
>        void *hcpu = (void *)(long)cpu;
>        unsigned long mod = tasks_frozen ? CPU_TASKS_FROZEN : 0;
> @@ -226,19 +225,15 @@ static int __ref _cpu_down(unsigned int
>        cpu_clear(cpu, tmp);
>        set_cpus_allowed_ptr(current, &tmp);
>
> -       p = __stop_machine_run(take_cpu_down, &tcd_param, cpu);
> +       err = __stop_machine_run(take_cpu_down, &tcd_param, cpu);
>
> -       if (IS_ERR(p) || cpu_online(cpu)) {
> +       if (err || cpu_online(cpu)) {

I think checking cpu_online() is now unnecessary by __stop_machine_run()
change in this patch. i.e. this line can simply be:

        if (err) {

Because __stop_machine_run(take_cpu_down, ...) returned zero means
take_cpu_down() has already finished and suceeded (returned zero).
It also means __cpu_disable() in take_cpu_down() has been succeeded.
So you can remove cpu_online() check.

>                /* CPU didn't die: tell everyone.  Can't complain. */
>                if (raw_notifier_call_chain(&cpu_chain, CPU_DOWN_FAILED | mod,
>                                            hcpu) == NOTIFY_BAD)
>                        BUG();
>
> -               if (IS_ERR(p)) {
> -                       err = PTR_ERR(p);
> -                       goto out_allowed;
> -               }
> -               goto out_thread;
> +               goto out_allowed;
>        }
>
>        /* Wait for it to sleep (leaving idle task). */
--
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