xfs
[Top] [All Lists]

Re: page_buf leak...

To: Daniel Moore <dxm@xxxxxxxxxxxxxxxxxxxxxxxx>
Subject: Re: page_buf leak...
From: Steve Lord <lord@xxxxxxx>
Date: Tue, 02 May 2000 07:44:53 -0500
Cc: linux-xfs@xxxxxxxxxxx
In-reply-to: Your message of "Tue, 02 May 2000 10:26:26 +1000
Sender: owner-linux-xfs@xxxxxxxxxxx

This looks mostly correct, but I prefer to save the address from pb_addr for the
kfree call rather than change when we call pagebuf_mapout_locked();

Steve

> 
> Problem:
> 
>    - make a clean fs
>    - mount, unmount at least twice
> 
> 128k slabs get alloced and not freed (see /proc/slabinfo) eventually
> causing an allocation failure.
> 
> When the page_bufs in question are passed to _pagebuf_free_object,
> their pointers are wiped by pagebuf_mapout_locked and the now NULL
> pointer is passed to kfree (kfree doesn't care).
> 
> pagebuf_mapout_locked clears the pointers of any page_buf with
> PBF_MAPPED set, but only returns the pointers of page_bufs with
> _PBF_ADDR_ALLOCATED set.
> 
> The page_bufs in question have PBF_MAPPED set but not _PBF_ADDR_ALLOCATED
> and hence their pointers get cleared and a NULL pointer is returned.
> 
> My fix is to change _pagebuf_free_object:
> 
> =>                 /* release any virtual mapping */ ;
> =>                 if (pb->pb_flags & PBF_MAPPED)
> =>                         vaddr = pagebuf_mapout_locked(pb); 
> 
> to
> 
> =>            /* release any virtual mapping */ ;
> =>            if (pb->pb_flags & _PBF_ADDR_ALLOCATED)
> =>                    vaddr = pagebuf_mapout_locked(pb); 
> 
> It fixes my problem but it might not be the "right thing" to do. 
> Comments?
> 
> -----------------------------------------------------
>  Daniel Moore                  dxm@xxxxxxx
>  R&D Software Engineer         Phone: +61-3-98348209
>  SGI Performance Tools Group   Fax:   +61-3-98132378
> -----------------------------------------------------

<Prev in Thread] Current Thread [Next in Thread>