From: Nitin Gupta <nitingupta910@gmail.com>
To: Marcin Slusarz <marcin.slusarz@gmail.com>
Cc: Andrew Morton <akpm@linux-foundation.org>,
Christoph Lameter <cl@linux-foundation.org>,
Pekka Enberg <penberg@cs.helsinki.fi>, Ed Tomlinson <edt@aei.ca>,
"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>
Subject: Re: [PATCH 1/3] xvmalloc memory allocator
Date: Sun, 29 Mar 2009 16:53:22 +0530 [thread overview]
Message-ID: <49CF5A2A.1010305@vflare.org> (raw)
In-Reply-To: <49CF4FFA.8090904@gmail.com>
Marcin Slusarz wrote:
> Nitin Gupta wrote:
>> +static void stat_inc(u64 *value)
>> +{
>> + (*value)++;
>> +}
>> +
>> +static void stat_dec(u64 *value)
>> +{
>> + (*value)--;
>> +}
>
> Why not open code it?
>
This looks nicer, doesn't it?
>> +
>> +static u32 test_flag(struct block_header *block, enum blockflags flag)
>> +{
>> + return block->prev & (1 << flag);
>> +}
>> +
>> +static void set_flag(struct block_header *block, enum blockflags flag)
>> +{
>> + block->prev |= (1 << flag);
>> +}
>> +
>> +static void clear_flag(struct block_header *block, enum blockflags flag)
>> +{
>> + block->prev &= ~(1 << flag);
>> +}
>
> Why don't you use test_bit / __set_bit / __clear_bit directly?
>
block->prev is 16 bits. __set_bit() etc. need unsigned long pointer.
>> +struct xv_pool *xv_create_pool(void)
>> +{
>> + int i;
>> + u32 ovhd_size;
>> + struct xv_pool *pool;
>> +
>> + ovhd_size = roundup(sizeof(*pool), PAGE_SIZE);
>> + pool = kmalloc(ovhd_size, GFP_KERNEL);
>> + if (!pool)
>> + return NULL;
>> +
>> + memset(pool, 0, ovhd_size);
>
> Please use kzalloc.
>
Ok...
>> +
>> + for (i = 0; i < NUM_FREE_LISTS; i++) {
>> + pool->freelist[i].pagenum = 0;
>> + pool->freelist[i].offset = 0;
>> + }
>
> It was already zeroed by memset.
>
Remains from earlier code; we used to set it to 'INVALID_PGNUM'.
Ok, will remove this.
Thanks for review.
Nitin
next prev parent reply other threads:[~2009-03-29 11:23 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2009-03-29 3:43 [PATCH 0/3] compressed in-memory swapping take4 Nitin Gupta
2009-03-29 3:46 ` [PATCH 1/3] xvmalloc memory allocator Nitin Gupta
2009-03-29 10:39 ` Marcin Slusarz
2009-03-29 11:23 ` Nitin Gupta [this message]
2009-03-29 3:51 ` [PATCH 2/3] ramzswap virtual block device Nitin Gupta
2009-03-29 3:53 ` [PATCH 3/3] ramzswap documentation Nitin Gupta
-- strict thread matches above, loose matches on Subject: below --
2009-09-22 4:56 [PATCH 0/3] compcache: in-memory compressed swapping v4 Nitin Gupta
2009-09-22 4:56 ` [PATCH 1/3] xvmalloc memory allocator Nitin Gupta
2009-09-22 4:56 ` Nitin Gupta
2009-03-30 14:48 [PATCH 0/3] compressed in-memory swapping take5 Nitin Gupta
2009-03-30 14:50 ` [PATCH 1/3] xvmalloc memory allocator Nitin Gupta
2009-03-24 19:01 [PATCH 0/3] compressed in-memory swapping take3 Nitin Gupta
2009-03-24 19:11 ` [PATCH 1/3] xvmalloc memory allocator Nitin Gupta
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=49CF5A2A.1010305@vflare.org \
--to=nitingupta910@gmail.com \
--cc=akpm@linux-foundation.org \
--cc=cl@linux-foundation.org \
--cc=edt@aei.ca \
--cc=linux-kernel@vger.kernel.org \
--cc=marcin.slusarz@gmail.com \
--cc=ngupta@vflare.org \
--cc=penberg@cs.helsinki.fi \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.