Re: [PATCH v3 1/6] lib/stackdepot: allow requesting early initialization dynamically

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On 4/5/22 23:40, David Rientjes wrote:
> On Mon, 4 Apr 2022, Vlastimil Babka wrote:
>> +int __init stack_depot_early_init(void)
>> +{
>> +	size_t size;
>> +
>> +	/* This is supposed to be called only once, from mm_init() */
>> +	if (WARN_ON(__stack_depot_early_init_passed))
>> +		return 0;
>> +
>> +	__stack_depot_early_init_passed = true;
>> +
>> +	if (!__stack_depot_want_early_init || stack_depot_disable)
>> +		return 0;
>> +
>> +	pr_info("Stack Depot early init allocating hash table with memblock_alloc\n");
>> +	size = (STACK_HASH_SIZE * sizeof(struct stack_record *));
> 
> I think the kvcalloc() in the main init path is very unlikely to fail, but 
> perhaps this memblock_alloc() might?  If so, a nit might be to include 
> this size as part of the printk.

OK, added the hunk at the end of mail. Example:

[0.062264] Stack Depot early init allocating hash table with memblock_alloc, 8388608 bytes

> Either way:
> 
> Acked-by: David Rientjes <rientjes@xxxxxxxxxx>

Thanks!

diff --git a/lib/stackdepot.c b/lib/stackdepot.c
index 6c4644c9ed44..5ca0d086ef4a 100644
--- a/lib/stackdepot.c
+++ b/lib/stackdepot.c
@@ -186,8 +186,9 @@ int __init stack_depot_early_init(void)
        if (!__stack_depot_want_early_init || stack_depot_disable)
                return 0;
 
-       pr_info("Stack Depot early init allocating hash table with memblock_alloc\n");
        size = (STACK_HASH_SIZE * sizeof(struct stack_record *));
+       pr_info("Stack Depot early init allocating hash table with memblock_alloc, %zu bytes\n",
+               size);
        stack_table = memblock_alloc(size, SMP_CACHE_BYTES);
 
        if (!stack_table) {




[Index of Archives]     [Linux ARM Kernel]     [Linux ARM]     [Linux Omap]     [Fedora ARM]     [IETF Annouce]     [Bugtraq]     [Linux OMAP]     [Linux MIPS]     [eCos]     [Asterisk Internet PBX]     [Linux API]

  Powered by Linux