lkml.org 
[lkml]   [2013]   [Oct]   [12]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
SubjectRe: [PATCH v3 2/3] mm/zswap: bugfix: memory leak when invalidate and reclaim occur concurrently
From
On Sat, Oct 12, 2013 at 10:32 AM, Bob Liu <lliubbo@gmail.com> wrote:
> On Thu, Sep 26, 2013 at 11:42 AM, Weijie Yang <weijie.yang@samsung.com> wrote:
>> On Tue, Sep 24, 2013 at 9:03 AM, Minchan Kim <minchan@kernel.org> wrote:
>>> On Mon, Sep 23, 2013 at 04:21:49PM +0800, Weijie Yang wrote:
>>> >
>>> > Modify:
>>> > - check the refcount in fail path, free memory if it is not referenced.
>>>
>>> Hmm, I don't like this because zswap refcount routine is already mess for me.
>>> I'm not sure why it was designed from the beginning. I hope we should fix it first.
>>>
>>> 1. zswap_rb_serach could include zswap_entry_get semantic if it founds a entry from
>>> the tree. Of course, we should ranme it as find_get_zswap_entry like find_get_page.
>>> 2. zswap_entry_put could hide resource free function like zswap_free_entry so that
>>> all of caller can use it easily following pattern.
>>>
>>> find_get_zswap_entry
>>> ...
>>> ...
>>> zswap_entry_put
>>>
>>> Of course, zswap_entry_put have to check the entry is in the tree or not
>>> so if someone already removes it from the tree, it should avoid double remove.
>>>
>>> One of the concern I can think is that approach extends critical section
>>> but I think it would be no problem because more bottleneck would be [de]compress
>>> functions. If it were really problem, we can mitigate a problem with moving
>>> unnecessary functions out of zswap_free_entry because it seem to be rather
>>> over-enginnering.
>>
>> I refactor the zswap refcount routine according to Minchan's idea.
>> Here is the new patch, Any suggestion is welcomed.
>>
>> To Seth and Bob, would you please review it again?
>>
>
> I have nothing in addition to Minchan's review.
>
> Since the code is a bit complex, I'd suggest you to split it into two patches.
> [1/2]: fix the memory leak
> [2/2]: clean up the entry_put
>
> And run some testing..

I will split and test it.

Thanks.

> Thanks,
> -Bob


\
 
 \ /
  Last update: 2013-10-12 11:01    [W:0.180 / U:0.556 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site