mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/next/linux-next.git
synced 2024-12-28 00:32:00 +00:00
livepatch: convert timeouts to secs_to_jiffies()
Commit b35108a51c
("jiffies: Define secs_to_jiffies()") introduced
secs_to_jiffies(). As the value here is a multiple of 1000, use
secs_to_jiffies() instead of msecs_to_jiffies to avoid the multiplication.
This is converted using scripts/coccinelle/misc/secs_to_jiffies.cocci with
the following Coccinelle rules:
@@ constant C; @@
- msecs_to_jiffies(C * 1000)
+ secs_to_jiffies(C)
@@ constant C; @@
- msecs_to_jiffies(C * MSEC_PER_SEC)
+ secs_to_jiffies(C)
Link: https://lkml.kernel.org/r/20241210-converge-secs-to-jiffies-v3-18-ddfefd7e9f2a@linux.microsoft.com
Signed-off-by: Easwar Hariharan <eahariha@linux.microsoft.com>
Reviewed-by: Christophe Leroy <christophe.leroy@csgroup.eu>
Cc: Alexander Gordeev <agordeev@linux.ibm.com>
Cc: Andrew Lunn <andrew+netdev@lunn.ch>
Cc: Anna-Maria Behnsen <anna-maria@linutronix.de>
Cc: Catalin Marinas <catalin.marinas@arm.com>
Cc: Christian Borntraeger <borntraeger@linux.ibm.com>
Cc: Daniel Mack <daniel@zonque.org>
Cc: David Airlie <airlied@gmail.com>
Cc: David S. Miller <davem@davemloft.net>
Cc: Dick Kennedy <dick.kennedy@broadcom.com>
Cc: Eric Dumazet <edumazet@google.com>
Cc: Florian Fainelli <florian.fainelli@broadcom.com>
Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Cc: Haojian Zhuang <haojian.zhuang@gmail.com>
Cc: Heiko Carstens <hca@linux.ibm.com>
Cc: Ilya Dryomov <idryomov@gmail.com>
Cc: Jack Wang <jinpu.wang@cloud.ionos.com>
Cc: Jakub Kicinski <kuba@kernel.org>
Cc: James Bottomley <James.Bottomley@HansenPartnership.com>
Cc: James Smart <james.smart@broadcom.com>
Cc: Jaroslav Kysela <perex@perex.cz>
Cc: Jeff Johnson <jjohnson@kernel.org>
Cc: Jeff Johnson <quic_jjohnson@quicinc.com>
Cc: Jens Axboe <axboe@kernel.dk>
Cc: Jeroen de Borst <jeroendb@google.com>
Cc: Jiri Kosina <jikos@kernel.org>
Cc: Joe Lawrence <joe.lawrence@redhat.com>
Cc: Johan Hedberg <johan.hedberg@gmail.com>
Cc: Josh Poimboeuf <jpoimboe@kernel.org>
Cc: Jozsef Kadlecsik <kadlec@netfilter.org>
Cc: Julia Lawall <julia.lawall@inria.fr>
Cc: Kalle Valo <kvalo@kernel.org>
Cc: Louis Peens <louis.peens@corigine.com>
Cc: Lucas De Marchi <lucas.demarchi@intel.com>
Cc: Luiz Augusto von Dentz <luiz.dentz@gmail.com>
Cc: Maarten Lankhorst <maarten.lankhorst@linux.intel.com>
Cc: Madhavan Srinivasan <maddy@linux.ibm.com>
Cc: Marcel Holtmann <marcel@holtmann.org>
Cc: Martin K. Petersen <martin.petersen@oracle.com>
Cc: Maxime Ripard <mripard@kernel.org>
Cc: Michael Ellerman <mpe@ellerman.id.au>
Cc: Miroslav Benes <mbenes@suse.cz>
Cc: Naveen N Rao <naveen@kernel.org>
Cc: Nicholas Piggin <npiggin@gmail.com>
Cc: Nicolas Palix <nicolas.palix@imag.fr>
Cc: Oded Gabbay <ogabbay@kernel.org>
Cc: Ofir Bitton <obitton@habana.ai>
Cc: Pablo Neira Ayuso <pablo@netfilter.org>
Cc: Paolo Abeni <pabeni@redhat.com>
Cc: Petr Mladek <pmladek@suse.com>
Cc: Praveen Kaligineedi <pkaligineedi@google.com>
Cc: Ray Jui <rjui@broadcom.com>
Cc: Robert Jarzmik <robert.jarzmik@free.fr>
Cc: Rodrigo Vivi <rodrigo.vivi@intel.com>
Cc: Roger Pau Monné <roger.pau@citrix.com>
Cc: Russell King <linux@armlinux.org.uk>
Cc: Scott Branden <sbranden@broadcom.com>
Cc: Shailend Chand <shailend@google.com>
Cc: Simona Vetter <simona@ffwll.ch>
Cc: Simon Horman <horms@kernel.org>
Cc: Sven Schnelle <svens@linux.ibm.com>
Cc: Takashi Iwai <tiwai@suse.com>
Cc: Thomas Hellström <thomas.hellstrom@linux.intel.com>
Cc: Thomas Zimmermann <tzimmermann@suse.de>
Cc: Vasily Gorbik <gor@linux.ibm.com>
Cc: Xiubo Li <xiubli@redhat.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
This commit is contained in:
parent
ea7ec1e01e
commit
fd5a65556e
@ -44,8 +44,7 @@ static void busymod_work_func(struct work_struct *work)
|
||||
static int livepatch_callbacks_mod_init(void)
|
||||
{
|
||||
pr_info("%s\n", __func__);
|
||||
schedule_delayed_work(&work,
|
||||
msecs_to_jiffies(1000 * 0));
|
||||
schedule_delayed_work(&work, 0);
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
@ -72,8 +72,7 @@ static struct dummy *livepatch_fix1_dummy_alloc(void)
|
||||
if (!d)
|
||||
return NULL;
|
||||
|
||||
d->jiffies_expire = jiffies +
|
||||
msecs_to_jiffies(1000 * EXPIRE_PERIOD);
|
||||
d->jiffies_expire = jiffies + secs_to_jiffies(EXPIRE_PERIOD);
|
||||
|
||||
/*
|
||||
* Patch: save the extra memory location into a SV_LEAK shadow
|
||||
|
@ -101,8 +101,7 @@ static __used noinline struct dummy *dummy_alloc(void)
|
||||
if (!d)
|
||||
return NULL;
|
||||
|
||||
d->jiffies_expire = jiffies +
|
||||
msecs_to_jiffies(1000 * EXPIRE_PERIOD);
|
||||
d->jiffies_expire = jiffies + secs_to_jiffies(EXPIRE_PERIOD);
|
||||
|
||||
/* Oops, forgot to save leak! */
|
||||
leak = kzalloc(sizeof(*leak), GFP_KERNEL);
|
||||
@ -152,8 +151,7 @@ static void alloc_work_func(struct work_struct *work)
|
||||
list_add(&d->list, &dummy_list);
|
||||
mutex_unlock(&dummy_list_mutex);
|
||||
|
||||
schedule_delayed_work(&alloc_dwork,
|
||||
msecs_to_jiffies(1000 * ALLOC_PERIOD));
|
||||
schedule_delayed_work(&alloc_dwork, secs_to_jiffies(ALLOC_PERIOD));
|
||||
}
|
||||
|
||||
/*
|
||||
@ -184,16 +182,13 @@ static void cleanup_work_func(struct work_struct *work)
|
||||
}
|
||||
mutex_unlock(&dummy_list_mutex);
|
||||
|
||||
schedule_delayed_work(&cleanup_dwork,
|
||||
msecs_to_jiffies(1000 * CLEANUP_PERIOD));
|
||||
schedule_delayed_work(&cleanup_dwork, secs_to_jiffies(CLEANUP_PERIOD));
|
||||
}
|
||||
|
||||
static int livepatch_shadow_mod_init(void)
|
||||
{
|
||||
schedule_delayed_work(&alloc_dwork,
|
||||
msecs_to_jiffies(1000 * ALLOC_PERIOD));
|
||||
schedule_delayed_work(&cleanup_dwork,
|
||||
msecs_to_jiffies(1000 * CLEANUP_PERIOD));
|
||||
schedule_delayed_work(&alloc_dwork, secs_to_jiffies(ALLOC_PERIOD));
|
||||
schedule_delayed_work(&cleanup_dwork, secs_to_jiffies(CLEANUP_PERIOD));
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user