mirror of
https://github.com/torvalds/linux.git
synced 2026-04-18 14:53:58 -04:00
Merge branch 'for-6.17-hash_pointers' into for-linus
This commit is contained in:
@@ -60,6 +60,20 @@
|
||||
bool no_hash_pointers __ro_after_init;
|
||||
EXPORT_SYMBOL_GPL(no_hash_pointers);
|
||||
|
||||
/*
|
||||
* Hashed pointers policy selected by "hash_pointers=..." boot param
|
||||
*
|
||||
* `auto` - Hashed pointers enabled unless disabled by slub_debug_enabled=true
|
||||
* `always` - Hashed pointers enabled unconditionally
|
||||
* `never` - Hashed pointers disabled unconditionally
|
||||
*/
|
||||
enum hash_pointers_policy {
|
||||
HASH_PTR_AUTO = 0,
|
||||
HASH_PTR_ALWAYS,
|
||||
HASH_PTR_NEVER
|
||||
};
|
||||
static enum hash_pointers_policy hash_pointers_mode __initdata;
|
||||
|
||||
noinline
|
||||
static unsigned long long simple_strntoull(const char *startp, char **endp, unsigned int base, size_t max_chars)
|
||||
{
|
||||
@@ -2270,12 +2284,23 @@ char *resource_or_range(const char *fmt, char *buf, char *end, void *ptr,
|
||||
return resource_string(buf, end, ptr, spec, fmt);
|
||||
}
|
||||
|
||||
int __init no_hash_pointers_enable(char *str)
|
||||
void __init hash_pointers_finalize(bool slub_debug)
|
||||
{
|
||||
if (no_hash_pointers)
|
||||
return 0;
|
||||
switch (hash_pointers_mode) {
|
||||
case HASH_PTR_ALWAYS:
|
||||
no_hash_pointers = false;
|
||||
break;
|
||||
case HASH_PTR_NEVER:
|
||||
no_hash_pointers = true;
|
||||
break;
|
||||
case HASH_PTR_AUTO:
|
||||
default:
|
||||
no_hash_pointers = slub_debug;
|
||||
break;
|
||||
}
|
||||
|
||||
no_hash_pointers = true;
|
||||
if (!no_hash_pointers)
|
||||
return;
|
||||
|
||||
pr_warn("**********************************************************\n");
|
||||
pr_warn("** NOTICE NOTICE NOTICE NOTICE NOTICE NOTICE NOTICE **\n");
|
||||
@@ -2288,11 +2313,39 @@ int __init no_hash_pointers_enable(char *str)
|
||||
pr_warn("** the kernel, report this immediately to your system **\n");
|
||||
pr_warn("** administrator! **\n");
|
||||
pr_warn("** **\n");
|
||||
pr_warn("** Use hash_pointers=always to force this mode off **\n");
|
||||
pr_warn("** **\n");
|
||||
pr_warn("** NOTICE NOTICE NOTICE NOTICE NOTICE NOTICE NOTICE **\n");
|
||||
pr_warn("**********************************************************\n");
|
||||
}
|
||||
|
||||
static int __init hash_pointers_mode_parse(char *str)
|
||||
{
|
||||
if (!str) {
|
||||
pr_warn("Hash pointers mode empty; falling back to auto.\n");
|
||||
hash_pointers_mode = HASH_PTR_AUTO;
|
||||
} else if (strncmp(str, "auto", 4) == 0) {
|
||||
pr_info("Hash pointers mode set to auto.\n");
|
||||
hash_pointers_mode = HASH_PTR_AUTO;
|
||||
} else if (strncmp(str, "never", 5) == 0) {
|
||||
pr_info("Hash pointers mode set to never.\n");
|
||||
hash_pointers_mode = HASH_PTR_NEVER;
|
||||
} else if (strncmp(str, "always", 6) == 0) {
|
||||
pr_info("Hash pointers mode set to always.\n");
|
||||
hash_pointers_mode = HASH_PTR_ALWAYS;
|
||||
} else {
|
||||
pr_warn("Unknown hash_pointers mode '%s' specified; assuming auto.\n", str);
|
||||
hash_pointers_mode = HASH_PTR_AUTO;
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
early_param("hash_pointers", hash_pointers_mode_parse);
|
||||
|
||||
static int __init no_hash_pointers_enable(char *str)
|
||||
{
|
||||
return hash_pointers_mode_parse("never");
|
||||
}
|
||||
early_param("no_hash_pointers", no_hash_pointers_enable);
|
||||
|
||||
/*
|
||||
|
||||
Reference in New Issue
Block a user