Skip to content

Commit a3f5f07

Browse files
Anton Vorontsovgregkh
authored andcommitted
pstore/platform: Make automatic updates interval configurable
There is no behavioural change, the default value is still 60 seconds. Signed-off-by: Anton Vorontsov <anton.vorontsov@linaro.org> Acked-by: Kees Cook <keescook@chromium.org> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
1 parent b8587da commit a3f5f07

1 file changed

Lines changed: 11 additions & 4 deletions

File tree

‎fs/pstore/platform.c‎

Lines changed: 11 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,7 @@
3131
#include <linux/slab.h>
3232
#include <linux/uaccess.h>
3333
#include <linux/hardirq.h>
34+
#include <linux/jiffies.h>
3435
#include <linux/workqueue.h>
3536

3637
#include "internal.h"
@@ -40,7 +41,10 @@
4041
* whether the system is actually still running well enough
4142
* to let someone see the entry
4243
*/
43-
#define PSTORE_INTERVAL (60 * HZ)
44+
static int pstore_update_ms = 60000;
45+
module_param_named(update_ms, pstore_update_ms, int, 0600);
46+
MODULE_PARM_DESC(update_ms, "milliseconds before pstore updates its content "
47+
"(default is 60000; -1 means runtime updates are disabled)");
4448

4549
static int pstore_new_entry;
4650

@@ -231,8 +235,11 @@ int pstore_register(struct pstore_info *psi)
231235
kmsg_dump_register(&pstore_dumper);
232236
pstore_register_console();
233237

234-
pstore_timer.expires = jiffies + PSTORE_INTERVAL;
235-
add_timer(&pstore_timer);
238+
if (pstore_update_ms >= 0) {
239+
pstore_timer.expires = jiffies +
240+
msecs_to_jiffies(pstore_update_ms);
241+
add_timer(&pstore_timer);
242+
}
236243

237244
return 0;
238245
}
@@ -291,7 +298,7 @@ static void pstore_timefunc(unsigned long dummy)
291298
schedule_work(&pstore_work);
292299
}
293300

294-
mod_timer(&pstore_timer, jiffies + PSTORE_INTERVAL);
301+
mod_timer(&pstore_timer, jiffies + msecs_to_jiffies(pstore_update_ms));
295302
}
296303

297304
module_param(backend, charp, 0444);

0 commit comments

Comments
 (0)