lkml.org 
[lkml]   [2005]   [Dec]   [8]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
    Patch in this message
    /
    Date
    From
    SubjectRe: allowed pages in the block later, was Re: [Ext2-devel] [PATCH] ext3: avoid sending down non-refcounted pages
    Hi,

    On 12/8/05, Mike Christie <michaelc@cs.wisc.edu> wrote:
    > Or there is not a way to do kmalloc(GFP_BLK) that gives us the right
    > type of memory is there?

    The slab allocator uses page->lru for special purposes. See
    page_{set|get}_{cache|slab} in mm/slab.c. They are used by kfree(),
    ksize() and slab debugging code to lookup the cache and slab an void
    pointer belongs to.

    But, if you just need put_page and get_page, couldn't you do something
    like the following?

    Pekka

    Index: 2.6/mm/swap.c
    ===================================================================
    --- 2.6.orig/mm/swap.c
    +++ 2.6/mm/swap.c
    @@ -36,6 +36,9 @@ int page_cluster;

    void put_page(struct page *page)
    {
    + if (unlikely(PageSlab(page)))
    + return;
    +
    if (unlikely(PageCompound(page))) {
    page = (struct page *)page_private(page);
    if (put_page_testzero(page)) {
    Index: 2.6/include/linux/mm.h
    ===================================================================
    --- 2.6.orig/include/linux/mm.h
    +++ 2.6/include/linux/mm.h
    @@ -322,6 +322,9 @@ static inline int page_count(struct page

    static inline void get_page(struct page *page)
    {
    + if (unlikely(PageSlab(page)))
    + return;
    +
    if (unlikely(PageCompound(page)))
    page = (struct page *)page_private(page);
    atomic_inc(&page->_count);
    -
    To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
    the body of a message to majordomo@vger.kernel.org
    More majordomo info at http://vger.kernel.org/majordomo-info.html
    Please read the FAQ at http://www.tux.org/lkml/
    \
     
     \ /
      Last update: 2005-12-08 20:23    [W:0.028 / U:62.088 seconds]
    ©2003-2016 Jasper Spaans. hosted at Digital OceanAdvertise on this site