Re: [PATCH 7/7] mm/page_alloc: Replace local_lock with normal spinlock
From: Marek Szyprowski
Date: Fri Jun 17 2022 - 02:47:21 EST
Hi Andrew,
On 16.06.2022 01:04, Andrew Morton wrote:
> On Thu, 16 Jun 2022 00:48:55 +0200 Marek Szyprowski <m.szyprowski@xxxxxxxxxxx> wrote:
>
>> In the logs I see lots of errors like:
>>
>> BUG: sleeping function called from invalid context at
>> ./include/linux/sched/mm.h:274
>>
>> BUG: scheduling while atomic: systemd-udevd/288/0x00000002
>>
>> BUG: sleeping function called from invalid context at mm/filemap.c:2647
>>
>> however there are also a fatal ones like:
>>
>> Unable to handle kernel paging request at virtual address 00000000017a87b4
>>
>>
>> The issues seems to be a bit random. Looks like memory trashing.
>> Reverting $subject on top of current linux-next fixes all those issues.
>>
>>
> This?
>
> --- a/mm/page_alloc.c~mm-page_alloc-replace-local_lock-with-normal-spinlock-fix
> +++ a/mm/page_alloc.c
> @@ -183,8 +183,10 @@ static DEFINE_MUTEX(pcp_batch_high_lock)
> type *_ret; \
> pcpu_task_pin(); \
> _ret = this_cpu_ptr(ptr); \
> - if (!spin_trylock_irqsave(&_ret->member, flags)) \
> + if (!spin_trylock_irqsave(&_ret->member, flags)) { \
> + pcpu_task_unpin(); \
> _ret = NULL; \
> + } \
> _ret; \
> })
>
>
> I'll drop Mel's patch for next -next.
Yes, this fixes the issues I've observed. Feel free to add:
Tested-by: Marek Szyprowski <m.szyprowski@xxxxxxxxxxx>
Best regards
--
Marek Szyprowski, PhD
Samsung R&D Institute Poland