* [PATCH] use might_sleep check if kmap_high is called from atomic context
@ 2024-08-20 1:53 zhangchun
2024-08-20 3:24 ` Matthew Wilcox
0 siblings, 1 reply; 3+ messages in thread
From: zhangchun @ 2024-08-20 1:53 UTC (permalink / raw)
To: akpm; +Cc: linux-kernel, linux-mm, jiaoxupo, shaohaojize, zhang.chuna
kmap_high is defined as EXPORT_SYMBOL, and cannot be called from atomic
context. Add might_sleep check is necessary.
Signed-off-by: zhangchun <zhang.chuna@h3c.com>
---
mm/highmem.c | 5 +++++
1 file changed, 5 insertions(+)
diff --git a/mm/highmem.c b/mm/highmem.c
index 07f2c67..5cfb5a9 100644
--- a/mm/highmem.c
+++ b/mm/highmem.c
@@ -319,6 +319,11 @@ void *kmap_high(struct page *page)
unsigned long vaddr;
/*
+ * Use might_sleep to check if kmap_high is called
+ * from atomic context.
+ */
+ might_sleep();
+ /*
* For highmem pages, we can't trust "virtual" until
* after we have the lock.
*/
--
1.8.3.1
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH] use might_sleep check if kmap_high is called from atomic context
2024-08-20 1:53 [PATCH] use might_sleep check if kmap_high is called from atomic context zhangchun
@ 2024-08-20 3:24 ` Matthew Wilcox
2024-08-20 6:33 ` zhangchun
0 siblings, 1 reply; 3+ messages in thread
From: Matthew Wilcox @ 2024-08-20 3:24 UTC (permalink / raw)
To: zhangchun; +Cc: akpm, linux-kernel, linux-mm, jiaoxupo, shaohaojize
On Tue, Aug 20, 2024 at 09:53:11AM +0800, zhangchun wrote:
> kmap_high is defined as EXPORT_SYMBOL, and cannot be called from atomic
> context. Add might_sleep check is necessary.
No. Nobody should be calling kmap_high() directly. There's already a
might_sleep() in kmap(). No need to add one in kmap_high().
^ permalink raw reply [flat|nested] 3+ messages in thread
* [PATCH] use might_sleep check if kmap_high is called from atomic context
2024-08-20 3:24 ` Matthew Wilcox
@ 2024-08-20 6:33 ` zhangchun
0 siblings, 0 replies; 3+ messages in thread
From: zhangchun @ 2024-08-20 6:33 UTC (permalink / raw)
To: willy; +Cc: akpm, jiaoxupo, linux-kernel, linux-mm, shaohaojize, zhang.chuna
>On Tue, Aug 20, 2024 at 09:53:11AM +0800, zhangchun wrote:
>> kmap_high is defined as EXPORT_SYMBOL, and cannot be called from
>> atomic context. Add might_sleep check is necessary.
>No. Nobody should be calling kmap_high() directly. There's already a
>might_sleep() in kmap(). No need to add one in kmap_high().
To avoid anyone calls kmap_high directly, add function description "Don't
use kmap_high directly, if necessary, please use kmap"
Signed-off-by: zhangchun <zhang.chuna@h3c.com>
--
1.8.3.1
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2024-08-20 6:33 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2024-08-20 1:53 [PATCH] use might_sleep check if kmap_high is called from atomic context zhangchun
2024-08-20 3:24 ` Matthew Wilcox
2024-08-20 6:33 ` zhangchun
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox