[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <CAL1ERfOhhJ12zXwsGJoHWRzkd2destQnJ32nfU25SOACCnzy7Q@mail.gmail.com>
Date: Sat, 26 Oct 2013 17:46:00 +0800
From: Weijie Yang <weijie.yang.kh@...il.com>
To: Minchan Kim <minchan@...nel.org>
Cc: Weijie Yang <weijie.yang@...sung.com>, akpm@...ux-foundation.org,
sjennings@...iantweb.net, bob.liu@...cle.com, linux-mm@...ck.org,
linux-kernel@...r.kernel.org, stable@...r.kernel.org
Subject: Re: [PATCH RESEND 2/2] mm/zswap: refoctor the get/put routines
On Fri, Oct 25, 2013 at 6:20 PM, Minchan Kim <minchan@...nel.org> wrote:
> On Thu, Oct 24, 2013 at 05:53:32PM +0800, Weijie Yang wrote:
>> The refcount routine was not fit the kernel get/put semantic exactly,
>> There were too many judgement statements on refcount and it could be minus.
>>
>> This patch does the following:
>>
>> - move refcount judgement to zswap_entry_put() to hide resource free function.
>>
>> - add a new function zswap_entry_find_get(), so that callers can use easily
>> in the following pattern:
>>
>> zswap_entry_find_get
>> .../* do something */
>> zswap_entry_put
>>
>> - to eliminate compile error, move some functions declaration
>>
>> This patch is based on Minchan Kim <minchan@...nel.org> 's idea and suggestion.
>>
>> Signed-off-by: Weijie Yang <weijie.yang@...sung.com>
>> Cc: Seth Jennings <sjennings@...iantweb.net>
>> Cc: Minchan Kim <minchan@...nel.org>
>> Cc: Bob Liu <bob.liu@...cle.com>
>
>
> I remember Bob had a idea to remove a look up and I think it's doable.
> Anyway, I don't mind you send it with fix or not.
Thanks for review.
Bob's idea is:
"Then how about use if (!RB_EMPTY_NODE(&entry->rbnode)) to
replace rbtree searching?"
I'm afraid not. Because entry could be freed in previous zswap_entry_put,
we cann't reference entry or we would touch a free-and-use issue.
> Thanks for handling this, Weijie!
>
> Acked-by: Minchan Kim <minchan@...nel.org>
>
> --
> Kind regards,
> Minchan Kim
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists