* [BUG] mm/vmalloc: ___might_sleep is called under a spinlock in __purge_vmap_area_lazy
@ 2017-10-09 4:00 Jia-Ju Bai
2017-10-09 4:10 ` Kirill A. Shutemov
0 siblings, 1 reply; 3+ messages in thread
From: Jia-Ju Bai @ 2017-10-09 4:00 UTC (permalink / raw)
To: akpm, mhocko, mingo, catalin.marinas, labbott, thgarnie,
kirill.shutemov, aryabinin, ard.biesheuvel, zijun_hu
Cc: linux-mm, Linux Kernel Mailing List
The ___might_sleep is called under a spinlock, and the function call
graph is:
__purge_vmap_area_lazy (acquire the spinlock)
cond_resched_lock
___might_sleep
In this situation, ___might_sleep may prints error log message because a
spinlock is held.
A possible fix is to remove ___might_sleep in cond_resched_lock.
This bug is found by my static analysis tool and my code review.
Thanks,
Jia-Ju Bai
--
To unsubscribe, send a message with 'unsubscribe linux-mm' in
the body to majordomo@kvack.org. For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"dont@kvack.org"> email@kvack.org </a>
^ permalink raw reply [flat|nested] 3+ messages in thread* Re: [BUG] mm/vmalloc: ___might_sleep is called under a spinlock in __purge_vmap_area_lazy
2017-10-09 4:00 [BUG] mm/vmalloc: ___might_sleep is called under a spinlock in __purge_vmap_area_lazy Jia-Ju Bai
@ 2017-10-09 4:10 ` Kirill A. Shutemov
2017-10-09 4:48 ` Jia-Ju Bai
0 siblings, 1 reply; 3+ messages in thread
From: Kirill A. Shutemov @ 2017-10-09 4:10 UTC (permalink / raw)
To: Jia-Ju Bai
Cc: akpm, mhocko, mingo, catalin.marinas, labbott, thgarnie,
kirill.shutemov, aryabinin, ard.biesheuvel, zijun_hu, linux-mm,
Linux Kernel Mailing List
On Mon, Oct 09, 2017 at 12:00:33PM +0800, Jia-Ju Bai wrote:
> The ___might_sleep is called under a spinlock, and the function call graph
> is:
> __purge_vmap_area_lazy (acquire the spinlock)
> cond_resched_lock
> ___might_sleep
>
> In this situation, ___might_sleep may prints error log message because a
> spinlock is held.
> A possible fix is to remove ___might_sleep in cond_resched_lock.
>
> This bug is found by my static analysis tool and my code review.
This analysis doesn't makes sense.
The point of cond_resched_lock() is that it drops the lock, if resched is
required.
___might_sleep() is called with preempt_offset equal to
PREEMPT_LOCK_OFFSET, so it won't report error if it's the only lock we
hold.
--
Kirill A. Shutemov
--
To unsubscribe, send a message with 'unsubscribe linux-mm' in
the body to majordomo@kvack.org. For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"dont@kvack.org"> email@kvack.org </a>
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [BUG] mm/vmalloc: ___might_sleep is called under a spinlock in __purge_vmap_area_lazy
2017-10-09 4:10 ` Kirill A. Shutemov
@ 2017-10-09 4:48 ` Jia-Ju Bai
0 siblings, 0 replies; 3+ messages in thread
From: Jia-Ju Bai @ 2017-10-09 4:48 UTC (permalink / raw)
To: Kirill A. Shutemov
Cc: akpm, mhocko, mingo, catalin.marinas, labbott, thgarnie,
kirill.shutemov, aryabinin, ard.biesheuvel, zijun_hu, linux-mm,
Linux Kernel Mailing List
Thanks for your reply and explanation :)
I will improve my analysis.
Thanks,
Jia-Ju Bai
On 2017/10/9 12:10, Kirill A. Shutemov wrote:
> On Mon, Oct 09, 2017 at 12:00:33PM +0800, Jia-Ju Bai wrote:
>> The ___might_sleep is called under a spinlock, and the function call graph
>> is:
>> __purge_vmap_area_lazy (acquire the spinlock)
>> cond_resched_lock
>> ___might_sleep
>>
>> In this situation, ___might_sleep may prints error log message because a
>> spinlock is held.
>> A possible fix is to remove ___might_sleep in cond_resched_lock.
>>
>> This bug is found by my static analysis tool and my code review.
> This analysis doesn't makes sense.
>
> The point of cond_resched_lock() is that it drops the lock, if resched is
> required.
>
> ___might_sleep() is called with preempt_offset equal to
> PREEMPT_LOCK_OFFSET, so it won't report error if it's the only lock we
> hold.
>
--
To unsubscribe, send a message with 'unsubscribe linux-mm' in
the body to majordomo@kvack.org. For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"dont@kvack.org"> email@kvack.org </a>
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2017-10-09 4:48 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-10-09 4:00 [BUG] mm/vmalloc: ___might_sleep is called under a spinlock in __purge_vmap_area_lazy Jia-Ju Bai
2017-10-09 4:10 ` Kirill A. Shutemov
2017-10-09 4:48 ` Jia-Ju Bai
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox