diff mbox series

[2/6] arm64/mm: Ensure PGD kmem cache object is actually allocated

Message ID 1548307220-19756-3-git-send-email-anshuman.khandual@arm.com (mailing list archive)
State New, archived
Headers show
Series arm64/mm: Enable accounting for page table pages | expand

Commit Message

Anshuman Khandual Jan. 24, 2019, 5:20 a.m. UTC
'pgd_cache' is created for allocating non PAGE_SIZE based PGD pointers. In
such cases ensure that the kmem cache object is allocated before proceeding
further with boot.

Signed-off-by: Anshuman Khandual <anshuman.khandual@arm.com>
---
 arch/arm64/mm/pgd.c | 1 +
 1 file changed, 1 insertion(+)

Comments

Catalin Marinas Jan. 24, 2019, 3:16 p.m. UTC | #1
On Thu, Jan 24, 2019 at 10:50:16AM +0530, Anshuman Khandual wrote:
> 'pgd_cache' is created for allocating non PAGE_SIZE based PGD pointers. In
> such cases ensure that the kmem cache object is allocated before proceeding
> further with boot.
> 
> Signed-off-by: Anshuman Khandual <anshuman.khandual@arm.com>
> ---
>  arch/arm64/mm/pgd.c | 1 +
>  1 file changed, 1 insertion(+)
> 
> diff --git a/arch/arm64/mm/pgd.c b/arch/arm64/mm/pgd.c
> index 289f911..8cb4e39 100644
> --- a/arch/arm64/mm/pgd.c
> +++ b/arch/arm64/mm/pgd.c
> @@ -62,4 +62,5 @@ void __init pgd_cache_init(void)
>  	 */
>  	pgd_cache = kmem_cache_create("pgd_cache", PGD_SIZE, PGD_SIZE,
>  				      SLAB_PANIC, NULL);
> +	BUG_ON(!pgd_cache);

Isn't SLAB_PANIC sufficient here?
Anshuman Khandual Jan. 25, 2019, 4:59 a.m. UTC | #2
On 01/24/2019 08:46 PM, Catalin Marinas wrote:
> On Thu, Jan 24, 2019 at 10:50:16AM +0530, Anshuman Khandual wrote:
>> 'pgd_cache' is created for allocating non PAGE_SIZE based PGD pointers. In
>> such cases ensure that the kmem cache object is allocated before proceeding
>> further with boot.
>>
>> Signed-off-by: Anshuman Khandual <anshuman.khandual@arm.com>
>> ---
>>  arch/arm64/mm/pgd.c | 1 +
>>  1 file changed, 1 insertion(+)
>>
>> diff --git a/arch/arm64/mm/pgd.c b/arch/arm64/mm/pgd.c
>> index 289f911..8cb4e39 100644
>> --- a/arch/arm64/mm/pgd.c
>> +++ b/arch/arm64/mm/pgd.c
>> @@ -62,4 +62,5 @@ void __init pgd_cache_init(void)
>>  	 */
>>  	pgd_cache = kmem_cache_create("pgd_cache", PGD_SIZE, PGD_SIZE,
>>  				      SLAB_PANIC, NULL);
>> +	BUG_ON(!pgd_cache);
> 
> Isn't SLAB_PANIC sufficient here?

It should be sufficient as it calls panic(). Please drop this patch from consideration.
diff mbox series

Patch

diff --git a/arch/arm64/mm/pgd.c b/arch/arm64/mm/pgd.c
index 289f911..8cb4e39 100644
--- a/arch/arm64/mm/pgd.c
+++ b/arch/arm64/mm/pgd.c
@@ -62,4 +62,5 @@  void __init pgd_cache_init(void)
 	 */
 	pgd_cache = kmem_cache_create("pgd_cache", PGD_SIZE, PGD_SIZE,
 				      SLAB_PANIC, NULL);
+	BUG_ON(!pgd_cache);
 }