Skip to contentSkip to conversation

Bug in mm.h?

DISCUSSION Leonid Podolny 1 participant 1 message Apr 7, 2005

lore
Share & tools
lore
#0 lore raw

I fail to understand whether the following is a bug. From what I see, if the page is reserved, page->count is not decreased. The order of the conditions should be reversed.

Quoted 1 line

From mm.h:

static inline void put_page(struct page *page)

{
        if (!PageReserved(page) && put_page_testzero(page))
                __page_cache_release(page);
}

static inline void get_page(struct page *page)

{
        atomic_inc(&page->_count);
}
#define put_page_testzero(p)                            \
        ({                                              \
                BUG_ON(page_count(p) == 0);             \
                atomic_add_negative(-1, &(p)->_count);  \
        })