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]
Message-ID: <CAAY4BKNv-nqHDcXhHt0dF5VP+SRBMHLFOf_NYCC7hesDOXuDCQ@mail.gmail.com>
Date:   Wed, 25 Aug 2021 18:07:13 +0800
From:   Mingzhe Yang <cainiao666999@...il.com>
To:     Thomas Gleixner <tglx@...utronix.de>
Cc:     peterz@...radead.org, linux-kernel@...r.kernel.org,
        yuxin.wooo@...il.com, becausehan@...il.com, huan.xie@...e.com
Subject: Re: [PATCH] tasklets: simplify code in tasklet_action_common()

Hi tglx,
Thanks for your review!

Sorry, I didn't think carefully enough about this patch.

I want to simplify code in tasklet_action_common, because it has more
than 3 levels of indentation. Let me try again without any new functions.

diff --git a/kernel/softirq.c b/kernel/softirq.c
--- a/kernel/softirq.c
+++ b/kernel/softirq.c
@@ -777,16 +777,16 @@ static void tasklet_action_common(struct
softirq_action *a,
                list = list->next;

                if (tasklet_trylock(t)) {
-                       if (!atomic_read(&t->count)) {
-                               if (tasklet_clear_sched(t)) {
-                                       if (t->use_callback)
-                                               t->callback(t);
-                                       else
-                                               t->func(t->data);
-                               }
+                       if (atomic_read(&t->count) || !tasklet_clear_sched(t)) {
                                tasklet_unlock(t);
                                continue;
                        }
+
+                       if (t->use_callback)
+                               t->callback(t);
+                       else
+                               t->func(t->data);
+
                        tasklet_unlock(t);
                }

--
Thanks,

        Mingzhe Yang

On Tue, Aug 10, 2021 at 9:12 PM Thomas Gleixner <tglx@...utronix.de> wrote:
>
> On Fri, Apr 30 2021 at 20:25, Mingzhe Yang wrote:
>
> > Use tasklet_is_disabled() to simplify the code in
> > tasklet_action_common.
>
> This changelog is not really helpful. Use a new function does not tell
> anything. Neither does it explain why there need to be two new functions
> and worse
>
> > +static inline bool tasklet_is_enabled(struct tasklet_struct *t)
> > +{
> > +     smp_rmb();
>
> why there is suddenly a new undocumented SMP barrier in the code.
>
> > +     return !atomic_read(&t->count);
> > +}
> > +
> > +static inline bool tasklet_is_disabled(struct tasklet_struct *t)
> > +{
> > +     return !tasklet_is_enabled(t);
> > +}
> > +
>
> Aside of that there is no point in exposing these functions in a global
> header.
>
> Thanks,
>
>         tglx

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ