[PATCH] mm: make compound page destructor handling explicit

Currently we we use the lru head link of the second page of a compound page
to hold its destructor.  This was ok when it was purely an internal
implmentation detail.  However, hugetlbfs overrides this destructor
violating the layering.  Abstract this out as explicit calls, also
introduce a type for the callback function allowing them to be type
checked.  For each callback we pre-declare the function, causing a type
error on definition rather than on use elsewhere.

[[email protected]: cleanups]
Signed-off-by: Andy Whitcroft <[email protected]>
Signed-off-by: Andrew Morton <[email protected]>
Signed-off-by: Linus Torvalds <[email protected]>
This commit is contained in:
Andy Whitcroft 2006-12-06 20:33:32 -08:00 • committed by Linus Torvalds
commit 33f2ef89f8
4 changed files with 22 additions and 4 deletions

View file

@ -57,9 +57,9 @@ static void put_compound_page(struct page *page)
{
page = (struct page *)page_private(page);
if (put_page_testzero(page)) {
void (*dtor)(struct page *page);
compound_page_dtor *dtor;
dtor = (void (*)(struct page *))page[1].lru.next;
dtor = get_compound_page_dtor(page);
(*dtor)(page);
}
}