Skip to contentSkip to conversation

New: XFS: iozone possible memory allocation deadlock

Bug 208805 [email protected] 2 participants 3 messages Aug 4, 2020 – Aug 26, 2020

lore
Share & tools
lore
#0 lore raw

https://bugzilla.kernel.org/show_bug.cgi?id=208805

Bug ID: 208805
Summary: XFS: iozone possible memory allocation deadlock
Product: File System
Version: 2.5
Kernel Version: Linux 5.4
Hardware: x86-64
OS: Linux
Tree: Mainline
Status: NEW
Severity: normal
Priority: P1
Component: XFS
Assignee: [email protected]
Reporter: [email protected]
Regression: No

When I ran iozone to test XFS in a memory insufficient situation,I found that iozone was blocked and The log "XFS: iozone possible memory allocation deadlock" was printed.

Reviewing the XFS code, I found that kmem_alloc(), xfs_buf_allocate_memory(), kmem_zone_alloc() and kmem_realloc() were implemented with "while" loops. These functions kept trying to get memory while the memory was insufficient, as a result of which "memory allocation deadlock" happened.

I think it may be a little unreasonable, although it can guarantee that the memory allocation succeed. Maybe using error handling code to handle the memory allocation failures is better.

Signature · 2 lines
You are receiving this mail because:
You are watching the assignee of the bug.
#1 lore raw
Quoted 22 lines · On Tue, Aug 04, 2020 at 09:52:48AM +0000, [email protected]…

https://bugzilla.kernel.org/show_bug.cgi?id=208805

Bug ID: 208805
Summary: XFS: iozone possible memory allocation deadlock
Product: File System
Version: 2.5
Kernel Version: Linux 5.4
Hardware: x86-64
OS: Linux
Tree: Mainline
Status: NEW
Severity: normal
Priority: P1
Component: XFS
Assignee: [email protected]
Reporter: [email protected]
Regression: No

When I ran iozone to test XFS in a memory insufficient situation,I found that iozone was blocked and The log "XFS: iozone possible memory allocation deadlock" was printed.

Quoted 9 lines

Reviewing the XFS code, I found that kmem_alloc(), xfs_buf_allocate_memory(), kmem_zone_alloc() and kmem_realloc() were implemented with "while" loops. These functions kept trying to get memory while the memory was insufficient, as a result of which "memory allocation deadlock" happened.

I think it may be a little unreasonable, although it can guarantee that the memory allocation succeed. Maybe using error handling code to handle the memory allocation failures is better.

I think some of this memory allocation code is currently being reworked, but that aside most of the above cases do break the retry loop if the caller passes KM_MAYFAIL. So it's a case by case basis as to whether a particular allocation should be allowed to fail and potentially return an error to userspace or should continue to retry.

A more useful approach to this bug would be to describe your test, the specific system/memory conditions, and provide the full log output (stack trace?) associated with the issue. Then perhaps we can analyze the cause and determine whether it's something that can be addressed or improved, or if you just need more memory. ;)

Brian

Quoted 4 lines
Signature · 2 lines
You are receiving this mail because:
You are watching the assignee of the bug.
#2 lore raw

[Bug 208805] XFS: iozone possible memory allocation deadlock

In reply to [email protected]

https://bugzilla.kernel.org/show_bug.cgi?id=208805

--- Comment #1 from [email protected] ---

Quoted 28 lines · On Tue, Aug 04, 2020 at 09:52:48AM +0000, [email protected]…

https://bugzilla.kernel.org/show_bug.cgi?id=208805

Bug ID: 208805
Summary: XFS: iozone possible memory allocation deadlock
Product: File System
Version: 2.5
Kernel Version: Linux 5.4
Hardware: x86-64
OS: Linux
Tree: Mainline
Status: NEW
Severity: normal
Priority: P1
Component: XFS
Assignee: [email protected]
Reporter: [email protected]
Regression: No

When I ran iozone to test XFS in a memory insufficient situation,I found that iozone was blocked and The log "XFS: iozone possible memory allocation deadlock" was printed.

Reviewing the XFS code, I found that kmem_alloc(), xfs_buf_allocate_memory(), kmem_zone_alloc() and kmem_realloc() were implemented with "while" loops. These
functions kept trying to get memory while the memory was insufficient, as a result of which "memory allocation deadlock" happened.

Quoted 5 lines

I think it may be a little unreasonable, although it can guarantee that the memory allocation succeed. Maybe using error handling code to handle the memory
allocation failures is better.

I think some of this memory allocation code is currently being reworked, but that aside most of the above cases do break the retry loop if the caller passes KM_MAYFAIL. So it's a case by case basis as to whether a particular allocation should be allowed to fail and potentially return an error to userspace or should continue to retry.

A more useful approach to this bug would be to describe your test, the specific system/memory conditions, and provide the full log output (stack trace?) associated with the issue. Then perhaps we can analyze the cause and determine whether it's something that can be addressed or improved, or if you just need more memory. ;)

Brian

Quoted 4 lines
Signature · 2 lines
You are receiving this mail because:
You are watching the assignee of the bug.
Signature · 2 lines
You are receiving this mail because:
You are watching the assignee of the bug.