From: Josh Poimboeuf <jpoimboe@redhat.com>
To: Artem Savkov <asavkov@redhat.com>
Cc: tglx@linutronix.de, netdev@vger.kernel.org, davem@davemloft.net,
yoshfuji@linux-ipv6.org, dsahern@kernel.org,
linux-kernel@vger.kernel.org
Subject: Re: [PATCH 1/2] timer: introduce upper bound timers
Date: Wed, 23 Mar 2022 11:40:26 -0700 [thread overview]
Message-ID: <20220323184026.wkj55y55jbeumngs@treble> (raw)
In-Reply-To: <20220323111642.2517885-2-asavkov@redhat.com>
On Wed, Mar 23, 2022 at 12:16:41PM +0100, Artem Savkov wrote:
> Add TIMER_UPPER_BOUND flag which allows creation of timers that would
> expire at most at specified time or earlier.
>
> This was previously discussed here:
> https://lore.kernel.org/all/20210302001054.4qgrvnkltvkgikzr@treble/T/#u
>
> Suggested-by: Josh Poimboeuf <jpoimboe@redhat.com>
> Signed-off-by: Artem Savkov <asavkov@redhat.com>
Thanks Artem, this approach looks good to me. Some kernel style nits...
The commit log could use some more background and motivation for the
change:
a) describe the current timer bound functionality and why it works for
most cases
b) describe the type of situation where it doesn't work and why
c) describe the solution
> ---
> include/linux/timer.h | 3 ++-
> kernel/time/timer.c | 36 ++++++++++++++++++++++--------------
> 2 files changed, 24 insertions(+), 15 deletions(-)
>
> diff --git a/include/linux/timer.h b/include/linux/timer.h
> index fda13c9d1256..9b0963f49528 100644
> --- a/include/linux/timer.h
> +++ b/include/linux/timer.h
> @@ -67,7 +67,8 @@ struct timer_list {
> #define TIMER_DEFERRABLE 0x00080000
> #define TIMER_PINNED 0x00100000
> #define TIMER_IRQSAFE 0x00200000
> -#define TIMER_INIT_FLAGS (TIMER_DEFERRABLE | TIMER_PINNED | TIMER_IRQSAFE)
> +#define TIMER_UPPER_BOUND 0x00400000
> +#define TIMER_INIT_FLAGS (TIMER_DEFERRABLE | TIMER_PINNED | TIMER_IRQSAFE | TIMER_UPPER_BOUND)
> #define TIMER_ARRAYSHIFT 22
> #define TIMER_ARRAYMASK 0xFFC00000
This new flag needs a comment above, where the other user flags are also
commented.
> }
> return idx;
> }
> @@ -607,7 +613,8 @@ static void internal_add_timer(struct timer_base *base, struct timer_list *timer
> unsigned long bucket_expiry;
> unsigned int idx;
>
> - idx = calc_wheel_index(timer->expires, base->clk, &bucket_expiry);
> + idx = calc_wheel_index(timer->expires, base->clk, &bucket_expiry,
> + timer->flags & TIMER_UPPER_BOUND);
Here and elsewhere, to follow kernel convention, the 2nd line needs
spaces after the tabs to align it with the previous line. That makes it
more obvious that the 2nd line is just another function argument. Like:
idx = calc_wheel_index(timer->expires, base->clk, &bucket_expiry,
timer->flags & TIMER_UPPER_BOUND);
--
Josh
next prev parent reply other threads:[~2022-03-23 18:40 UTC|newest]
Thread overview: 35+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-03-23 11:16 [PATCH 0/2] Upper bound mode for kernel timers Artem Savkov
2022-03-23 11:16 ` [PATCH 1/2] timer: introduce upper bound timers Artem Savkov
2022-03-23 18:40 ` Josh Poimboeuf [this message]
2022-03-24 9:14 ` [PATCH v2 0/2] Upper bound mode for kernel timers Artem Savkov
2022-03-24 9:14 ` [PATCH v2 1/2] timer: introduce upper bound timers Artem Savkov
2022-03-24 9:15 ` [PATCH v2 2/2] net: make tcp keepalive timer upper bound Artem Savkov
2022-03-24 12:28 ` [PATCH 1/2] timer: introduce upper bound timers Thomas Gleixner
2022-03-24 13:54 ` Thomas Gleixner
2022-03-26 21:13 ` Thomas Gleixner
2022-03-30 8:20 ` [PATCH v3 0/2] Upper bound kernel timers Artem Savkov
2022-03-30 8:20 ` [PATCH v3 1/2] timer: add a function to adjust timeouts to be upper bound Artem Savkov
2022-03-30 13:40 ` Anna-Maria Behnsen
2022-04-02 6:55 ` Artem Savkov
2022-04-05 15:33 ` Thomas Gleixner
2022-04-07 7:52 ` [PATCH v4 0/2] Upper bound kernel timers Artem Savkov
2022-04-07 7:52 ` [PATCH v4 1/2] timer: add a function to adjust timeouts to be upper bound Artem Savkov
2022-04-08 0:37 ` Thomas Gleixner
2022-04-08 5:39 ` Josh Poimboeuf
2022-04-12 13:42 ` Artem Savkov
2022-05-05 13:18 ` [PATCH v5 0/2] Upper bound kernel timers Artem Savkov
2022-05-05 13:18 ` [PATCH v5 1/2] timer: add a function to adjust timeouts to be upper bound Artem Savkov
2022-05-05 13:18 ` [PATCH v5 2/2] net: make tcp keepalive timer " Artem Savkov
2022-05-05 17:56 ` Josh Poimboeuf
2022-05-06 6:39 ` Artem Savkov
2022-05-06 16:24 ` Josh Poimboeuf
2022-07-26 22:42 ` [PATCH v5 0/2] Upper bound kernel timers Josh Poimboeuf
2022-04-07 7:52 ` [PATCH v4 2/2] net: make tcp keepalive timer upper bound Artem Savkov
[not found] ` <Yk1i3WrcVIICAiF0@samus.usersys.redhat.com>
2022-04-07 23:26 ` [PATCH v3 1/2] timer: add a function to adjust timeouts to be " Thomas Gleixner
2022-03-30 8:20 ` [PATCH v3 2/2] net: make tcp keepalive timer " Artem Savkov
2022-04-02 3:09 ` [net] 6ef3f95797: UBSAN:shift-out-of-bounds_in_kernel/time/timer.c kernel test robot
2022-04-02 7:11 ` Artem Savkov
2022-03-30 10:28 ` [PATCH v3 0/2] Upper bound kernel timers David Laight
2022-03-25 7:38 ` [timer] d41e0719d5: UBSAN:shift-out-of-bounds_in_lib/flex_proportions.c kernel test robot
2022-03-25 19:14 ` Thomas Gleixner
2022-03-23 11:16 ` [PATCH 2/2] net: make tcp keepalive timer upper bound Artem Savkov
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=20220323184026.wkj55y55jbeumngs@treble \
--to=jpoimboe@redhat.com \
--cc=asavkov@redhat.com \
--cc=davem@davemloft.net \
--cc=dsahern@kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=netdev@vger.kernel.org \
--cc=tglx@linutronix.de \
--cc=yoshfuji@linux-ipv6.org \
/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