Skip to contentSkip to conversation

Bug in page_cache_tree_delete?

DISCUSSION Jan Kara 2 participants 3 messages Nov 8, 2016 Memory management

lore
Share & tools
lore

Jan Kara

author
#0 lore raw

Hi Kirill,

I've noticed that your commit 83929372f629 (filemap: prepare find and delete operations for huge pages) added to page_cache_tree_delete():

	int i, nr = PageHuge(page) ? 1 : hpage_nr_pages(page);

Isn't the logic computing 'nr' inverted? I'd expect that if page is !PageHuge, we want to delete just one page... OTOH I'm surprised this would not blow up anywhere if it was really wrong so maybe I just miss something.

Honza

Signature · 8 lines
Jan Kara <[email protected]>
SUSE Labs, CR

--
To unsubscribe, send a message with 'unsubscribe linux-mm' in
the body to [email protected].  For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"[email protected]"> [email protected] </a>
#1 lore raw
Quoted 10 lines · Jan Kara

Hi Kirill,

I've noticed that your commit 83929372f629 (filemap: prepare find and delete operations for huge pages) added to page_cache_tree_delete():

	int i, nr = PageHuge(page) ? 1 : hpage_nr_pages(page);

Isn't the logic computing 'nr' inverted? I'd expect that if page is !PageHuge, we want to delete just one page... OTOH I'm surprised this would not blow up anywhere if it was really wrong so maybe I just miss something.

No, that's not bug.

PageHuge() detects hugetlb pages (we probably should rename the helper) which represented by one entry on radix-tree per huge page.

Signature · 7 lines
 Kirill A. Shutemov

--
To unsubscribe, send a message with 'unsubscribe linux-mm' in
the body to [email protected].  For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"[email protected]"> [email protected] </a>
author
#2 lore raw
Quoted 8 lines · Kirill A. Shutemov
Quoted 7 lines · Jan Kara

Hi Kirill,

I've noticed that your commit 83929372f629 (filemap: prepare find and delete operations for huge pages) added to page_cache_tree_delete():

	int i, nr = PageHuge(page) ? 1 : hpage_nr_pages(page);
Quoted 8 lines
Quoted 3 lines

Isn't the logic computing 'nr' inverted? I'd expect that if page is !PageHuge, we want to delete just one page... OTOH I'm surprised this would not blow up anywhere if it was really wrong so maybe I just miss something.

No, that's not bug.

PageHuge() detects hugetlb pages (we probably should rename the helper) which represented by one entry on radix-tree per huge page.

Ah, right. Thanks for explanation! Maybe that line would deserve a comment?

Honza

Signature · 8 lines
Jan Kara <[email protected]>
SUSE Labs, CR

--
To unsubscribe, send a message with 'unsubscribe linux-mm' in
the body to [email protected].  For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"[email protected]"> [email protected] </a>