mm.h: fix BUG_ON() condition in put_page_alloc_ref()
PATCH 1/1 mm.h: fix BUG_ON() condition in put_page_alloc_ref()
The BUG_ON() was misplaced when this function was introduced in commit ec83f825 "mm.h: add helper function to test-and-clear _PGC_allocated". It will fire incorrectly if _PGC_allocated is already clear on entry. Thus it should be moved after the if statement.
---
Cc: Andrew Cooper <[email protected]>
Cc: George Dunlap <[email protected]>
Cc: Ian Jackson <[email protected]>
Cc: Jan Beulich <[email protected]>
Cc: Julien Grall <[email protected]>
Cc: Konrad Rzeszutek Wilk <[email protected]>
Cc: Stefano Stabellini <[email protected]>
Cc: Tim Deegan <[email protected]>
Cc: Wei Liu <[email protected]>
--- xen/include/xen/mm.h | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)
xen/include/xen/mm.h +3 -1
@@ -667,9 +667,11 @@ static inline void put_page_alloc_ref(struct page_info *page)* the caller holding an additional reference. I.e. the allocation * reference must never be the last reference held. */ -BUG_ON ((page->count_info & PGC_count_mask) <=1 );if (test_and_clear_bit (_PGC_allocated, &page->count_info) ) + { +BUG_ON ((page->count_info & PGC_count_mask) <=1 );put_page (page); + } }#endif /* __XEN_MM_H__ */
Signature · 7 lines
2.20.1.2.gb21ebb671 _______________________________________________ Xen-devel mailing list [email protected] https://lists.xenproject.org/mailman/listinfo/xen-devel
Quoted 6 lines · Paul Durrant
The
BUG_ON()was misplaced when this function was introduced in commitec83f825"mm.h: add helper function to test-and-clear_PGC_allocated". It will fire incorrectly if_PGC_allocatedis already clear on entry. Thus it should be moved after the if statement.Signed-off-by Paul Durrant <[email protected]>
And indeed I should have noticed during review. Thanks.
and in it goes.
Jan
_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xenproject.org/mailman/listinfo/xen-devel