mm/hugetlb: avoid unnecessary hugetlb_acct_memory() call
Subsystems (2)
PATCH v2 1/1 mm/hugetlb: avoid unnecessary hugetlb_acct_memory() call
When gbl_reserve is 0, hugetlb_acct_memory() will do nothing except holding and releasing hugetlb_lock. We should avoid this unnecessary hugetlb_lock lock/unlock cycle which is happening on 'most' hugetlb munmap operations by check delta against 0 at the beginning of hugetlb_acct_memory.
--- mm/hugetlb.c | 3 +++ 1 file changed, 3 insertions(+)
mm/hugetlb.c +3 -0
@@ -3591,6 +3591,9 @@ static int hugetlb_acct_memory(struct hstate *h, long delta) {int ret = -ENOMEM ; +if (!delta) +return 0 ; +spin_lock (&hugetlb_lock);/* * When cpuset is configured, it breaks the strict hugetlb page
Signature · 1 line
2.19.1
Quoted 7 lines · Miaohe Lin
When
gbl_reserveis 0,hugetlb_acct_memory()will do nothing except holding and releasinghugetlb_lock. We should avoid this unnecessaryhugetlb_locklock/unlock cycle which is happening on 'most' hugetlb munmap operations by check delta against 0 at the beginning ofhugetlb_acct_memory.Reviewed-by David Hildenbrand <[email protected]>Signed-off-by Miaohe Lin <[email protected]>
I would avoid mentioning gbl_reserve as not all callers use it, and focus on what delta means:
"When reservation accounting remains unchanged..", but anyway:
Signature · 2 lines
Oscar Salvador SUSE L3
Hi:
Quoted 6 lines · Oscar Salvador
Quoted 5 lines · Miaohe Lin
When
gbl_reserveis 0,hugetlb_acct_memory()will do nothing except holding and releasinghugetlb_lock. We should avoid this unnecessaryhugetlb_locklock/unlock cycle which is happening on 'most' hugetlb munmap operations by check delta against 0 at the beginning ofhugetlb_acct_memory.
Quoted 7 lines
Quoted 2 lines
Reviewed-by David Hildenbrand <[email protected]>Signed-off-by Miaohe Lin <[email protected]>I would avoid mentioning
gbl_reserveas not all callers use it, and focus on what delta means:"When reservation accounting remains unchanged..", but anyway:
Sounds good. Maybe Andrew could kindly do this if this patch is picked up ?
Quoted 4 lines
Reviewed-by Oscar Salvador <[email protected]>
Many thanks for your review.
Quoted 12 lines · Miaohe Lin
Hi:
Quoted 9 lines · Oscar Salvador
Quoted 7 lines · Miaohe Lin
When
gbl_reserveis 0,hugetlb_acct_memory()will do nothing except holding and releasinghugetlb_lock. We should avoid this unnecessaryhugetlb_locklock/unlock cycle which is happening on 'most' hugetlb munmap operations by check delta against 0 at the beginning ofhugetlb_acct_memory.Reviewed-by David Hildenbrand <[email protected]>Signed-off-by Miaohe Lin <[email protected]>
Quoted 6 lines
Quoted 4 lines
I would avoid mentioning
gbl_reserveas not all callers use it, and focus on what delta means:"When reservation accounting remains unchanged..", but anyway:
Sounds good. Maybe Andrew could kindly do this if this patch is picked up ?
Thank you and Andrew.
Looks like Andrew updated the commit message and added to his tree.
Signature · 1 line
Mike Kravetz