From: "André Almeida" <andrealmeid@collabora.com>
To: Thomas Gleixner <tglx@linutronix.de>,
LKML <linux-kernel@vger.kernel.org>
Cc: Peter Zijlstra <peterz@infradead.org>,
Adhemerval Zanella <adhemerval.zanella@linaro.org>,
Lukasz Majewski <lukma@denx.de>,
Florian Weimer <fweimer@redhat.com>,
Carlos O'Donell <carlos@redhat.com>,
"Michael Kerrisk (man-pages)" <mtk.manpages@gmail.com>,
Davidlohr Bueso <dave@stgolabs.net>,
Ingo Molnar <mingo@kernel.org>,
Darren Hart <dvhart@infradead.org>,
Andrei Vagin <avagin@gmail.com>,
Kurt Kanzenbach <kurt@linutronix.de>,
kernel@collabora.com
Subject: Re: [patch 3/6] futex: Get rid of the val2 conditional dance
Date: Fri, 23 Apr 2021 18:40:13 -0300 [thread overview]
Message-ID: <f8cda7fa-46e9-5add-ccb6-441323ba2042@collabora.com> (raw)
In-Reply-To: <20210422194705.125957049@linutronix.de>
Hi Thomas,
Às 16:44 de 22/04/21, Thomas Gleixner escreveu:
> There is no point in checking which FUTEX operand treats the utime pointer
> as 'val2' argument because that argument to do_futex() is only used by
> exactly these operands.
>
> So just handing it in unconditionally is not making any difference, but
> removes a lot of pointless gunk.
>
> Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
> ---
> kernel/futex.c | 16 ++--------------
> 1 file changed, 2 insertions(+), 14 deletions(-)
>
> --- a/kernel/futex.c
> +++ b/kernel/futex.c
> @@ -3765,7 +3765,6 @@ SYSCALL_DEFINE6(futex, u32 __user *, uad
> {
> struct timespec64 ts;
> ktime_t t, *tp = NULL;
> - u32 val2 = 0;
> int cmd = op & FUTEX_CMD_MASK;
>
> if (utime && (cmd == FUTEX_WAIT || cmd == FUTEX_LOCK_PI ||
> @@ -3785,15 +3784,8 @@ SYSCALL_DEFINE6(futex, u32 __user *, uad
> t = timens_ktime_to_host(CLOCK_MONOTONIC, t);
> tp = &t;
> }
> - /*
> - * requeue parameter in 'utime' if cmd == FUTEX_*_REQUEUE_*.
> - * number of waiters to wake in 'utime' if cmd == FUTEX_WAKE_OP.
> - */
> - if (cmd == FUTEX_REQUEUE || cmd == FUTEX_CMP_REQUEUE ||
> - cmd == FUTEX_CMP_REQUEUE_PI || cmd == FUTEX_WAKE_OP)
> - val2 = (u32) (unsigned long) utime;
>
> - return do_futex(uaddr, op, val, tp, uaddr2, val2, val3);
> + return do_futex(uaddr, op, val, tp, uaddr2, (unsigned long)utime, val3);
Given do_futex()'s type signature, I think it makes more sense to cast
utime to u32.
> }
>
> #ifdef CONFIG_COMPAT
> @@ -3961,7 +3953,6 @@ SYSCALL_DEFINE6(futex_time32, u32 __user
> {
> struct timespec64 ts;
> ktime_t t, *tp = NULL;
> - int val2 = 0;
> int cmd = op & FUTEX_CMD_MASK;
>
> if (utime && (cmd == FUTEX_WAIT || cmd == FUTEX_LOCK_PI ||
> @@ -3979,11 +3970,8 @@ SYSCALL_DEFINE6(futex_time32, u32 __user
> t = timens_ktime_to_host(CLOCK_MONOTONIC, t);
> tp = &t;
> }
> - if (cmd == FUTEX_REQUEUE || cmd == FUTEX_CMP_REQUEUE ||
> - cmd == FUTEX_CMP_REQUEUE_PI || cmd == FUTEX_WAKE_OP)
> - val2 = (int) (unsigned long) utime;
>
> - return do_futex(uaddr, op, val, tp, uaddr2, val2, val3);
> + return do_futex(uaddr, op, val, tp, uaddr2, (unsigned long)utime, val3);
Same here.
> }
> #endif /* CONFIG_COMPAT_32BIT_TIME */
>
>
next prev parent reply other threads:[~2021-04-23 21:40 UTC|newest]
Thread overview: 22+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-04-22 19:44 [patch 0/6] futex: Bugfixes and FUTEX_LOCK_PI2 Thomas Gleixner
2021-04-22 19:44 ` [patch 1/6] Revert 337f13046ff0 ("futex: Allow FUTEX_CLOCK_REALTIME with FUTEX_WAIT op") Thomas Gleixner
2021-05-06 18:14 ` [tip: locking/urgent] " tip-bot2 for Thomas Gleixner
2021-04-22 19:44 ` [patch 2/6] futex: Do not apply time namespace adjustment on FUTEX_LOCK_PI Thomas Gleixner
2021-05-06 18:14 ` [tip: locking/urgent] " tip-bot2 for Thomas Gleixner
2021-04-22 19:44 ` [patch 3/6] futex: Get rid of the val2 conditional dance Thomas Gleixner
2021-04-23 21:40 ` André Almeida [this message]
2021-04-23 22:34 ` Thomas Gleixner
2021-04-23 23:21 ` André Almeida
2021-05-06 18:20 ` [tip: locking/urgent] " tip-bot2 for Thomas Gleixner
2021-04-22 19:44 ` [patch 4/6] futex: Make syscall entry points less convoluted Thomas Gleixner
2021-05-06 18:20 ` [tip: locking/urgent] " tip-bot2 for Thomas Gleixner
2021-04-22 19:44 ` [patch 5/6] futex: Prepare futex_lock_pi() for runtime clock selection Thomas Gleixner
2021-04-23 9:34 ` Lukasz Majewski
2021-04-23 10:08 ` Thomas Gleixner
2021-06-23 8:19 ` [tip: locking/core] " tip-bot2 for Thomas Gleixner
2021-04-22 19:44 ` [patch 6/6] futex: Provide FUTEX_LOCK_PI2 to support " Thomas Gleixner
2021-04-23 22:20 ` André Almeida
2021-04-23 22:36 ` Thomas Gleixner
2021-06-23 8:19 ` [tip: locking/core] " tip-bot2 for Thomas Gleixner
2021-05-05 12:59 ` [patch 0/6] futex: Bugfixes and FUTEX_LOCK_PI2 Peter Zijlstra
2021-05-05 13:51 ` Kurt Kanzenbach
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=f8cda7fa-46e9-5add-ccb6-441323ba2042@collabora.com \
--to=andrealmeid@collabora.com \
--cc=adhemerval.zanella@linaro.org \
--cc=avagin@gmail.com \
--cc=carlos@redhat.com \
--cc=dave@stgolabs.net \
--cc=dvhart@infradead.org \
--cc=fweimer@redhat.com \
--cc=kernel@collabora.com \
--cc=kurt@linutronix.de \
--cc=linux-kernel@vger.kernel.org \
--cc=lukma@denx.de \
--cc=mingo@kernel.org \
--cc=mtk.manpages@gmail.com \
--cc=peterz@infradead.org \
--cc=tglx@linutronix.de \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®