lkml.org 
[lkml]   [2011]   [Nov]   [10]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [PATCH 2/3] pids: Split alloc_pidmap into parts
On 11/10, Pavel Emelyanov wrote:
>
> The map's page allocation code is moved to separate function
> to make clone-with-pids patching simpler.

Sorry for the really cosmetic nit, but I simply can't resist...

> +static int alloc_pidmap_page(struct pidmap *map)
> +{
> + void *page = kzalloc(PAGE_SIZE, GFP_KERNEL);
> +
> + /*
> + * Free the page if someone raced with us
> + * installing it:
> + */
> + spin_lock_irq(&pidmap_lock);
> + if (!map->page) {
> + map->page = page;
> + page = NULL;
> + }
> + spin_unlock_irq(&pidmap_lock);
> + kfree(page);
> +
> + return map->page ? 0 : -1;

Again, I won't insist, but "return !map->page" looks more readable.
Even better (imho) would be to return map->page, and change the
single caller to check "if (!alloc_pidnap_page())".
Oleg.



\
 
 \ /
  Last update: 2011-11-10 19:21    [from the cache]
©2003-2014 Jasper Spaans. hosted at Digital Ocean