Skip to contentSkip to conversation

mm/page_alloc: avoid hard lockups in __alloc_pages_bulk()

PATCH In review [email protected] 4 participants 5 messages Jul 10, 2021 – Jul 15, 2021

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 mm/page_alloc: avoid hard lockups in __alloc_pages_bulk()

From: Zqiang <[email protected]>

The __alloc_pages_bulk() mainly used for batch allocation of order-0 pages, in the case of holding pagesets.lock, if too many pages are required, maybe trigger hard lockup watchdog.

---
 mm/page_alloc.c | 2 ++
 1 file changed, 2 insertions(+)
mm/page_alloc.c +2 -0
index d6e94cc8066c..1127db25507f 100644
@@ -5315,6 +5315,8 @@ unsigned long __alloc_pages_bulk(gfp_t gfp, int preferred_nid,
 		else
 			page_array[nr_populated] = page;
 		nr_populated++;
+
+		touch_nmi_watchdog();
 	}
 
 	local_unlock_irqrestore(&pagesets.lock, flags);
Signature · 1 line
2.25.1
maintainer
#1 lore raw
Quoted 5 lines · On Sat, 10 Jul 2021 19:29:29 +0800 [email protected] wrote:

From: Zqiang <[email protected]>

The __alloc_pages_bulk() mainly used for batch allocation of order-0 pages, in the case of holding pagesets.lock, if too many pages are required, maybe trigger hard lockup watchdog.

Ouch. Has this been observed in testing? If so, can you please share the kernel debug output from that event?

#2 lore raw
Quoted 10 lines · Andrew Morton
Quoted 5 lines · On Sat, 10 Jul 2021 19:29:29 +0800 [email protected] wrote:

From: Zqiang <[email protected]>

The __alloc_pages_bulk() mainly used for batch allocation of order-0 pages, in the case of holding pagesets.lock, if too many pages are required, maybe trigger hard lockup watchdog.

Ouch. Has this been observed in testing? If so, can you please share the kernel debug output from that event?

This should be fixed in the caller by asking for fewer pages. The NFS and vmalloc cases have already been fixed for this.

#3 lore raw

________________________________
发件人: Matthew Wilcox <[email protected]>
发送时间: 星期日, 七月 11, 2021 05:10
收件人: Andrew Morton
抄送: Zhang, Qiang; [email protected]; [email protected]; [email protected] 主题: Re: [PATCH] mm/page_alloc: avoid hard lockups in __alloc_pages_bulk()

[Please note: This e-mail is from an EXTERNAL e-mail address]

Quoted 8 lines · Andrew Morton
Quoted 5 lines · On Sat, 10 Jul 2021 19:29:29 +0800 [email protected] wrote:

From: Zqiang <[email protected]>

The __alloc_pages_bulk() mainly used for batch allocation of order-0 pages, in the case of holding pagesets.lock, if too many pages are required, maybe trigger hard lockup watchdog.

Quoted 5 lines

Ouch. Has this been observed in testing? If so, can you please share the kernel debug output from that event?

This should be fixed in the caller by asking for fewer pages. The NFS and vmalloc cases have already been fixed for this.

The NFS and vmalloc cases haven been fixed? I don’t see if there is any information about that?

Thanks
Qiang

#4 lore raw
Quoted 18 lines · Qiang

________________________________
??????: Matthew Wilcox <[email protected]>
????????: ??????, ???? 11, 2021 05:10
??????: Andrew Morton
????: Zhang, Qiang; [email protected]; [email protected]; [email protected] ????: Re: [PATCH] mm/page_alloc: avoid hard lockups in __alloc_pages_bulk()

[Please note: This e-mail is from an EXTERNAL e-mail address]

Quoted 8 lines · Andrew Morton
Quoted 5 lines · On Sat, 10 Jul 2021 19:29:29 +0800 [email protected] wrote:

From: Zqiang <[email protected]>

The __alloc_pages_bulk() mainly used for batch allocation of order-0 pages, in the case of holding pagesets.lock, if too many pages are required, maybe trigger hard lockup watchdog.

Quoted 9 lines
Quoted 5 lines

Ouch. Has this been observed in testing? If so, can you please share the kernel debug output from that event?

This should be fixed in the caller by asking for fewer pages. The NFS and vmalloc cases have already been fixed for this.

The NFS and vmalloc cases haven been fixed?? I don??t see if there is any information about that?

AFAIK, NFS simply doesn't ask for a large enough number of pages to be of concern. For vmalloc, it's somewhat theoritical that it can happen for anything other than a stress test but this exists
https://lore.kernel.org/r/[email protected]

I had no objection to the patch but didn't feel strongly enough to say anything about it either given that it was triggered artifically.

Signature · 2 lines
Mel Gorman
SUSE Labs