* [PATCH] cgroup.c: Some 'hlist_head' function fixes.
@ 2008-08-08 15:29 Rakib Mullick
2008-08-09 21:07 ` Paul Jackson
0 siblings, 1 reply; 3+ messages in thread
From: Rakib Mullick @ 2008-08-08 15:29 UTC (permalink / raw)
To: Paul Menage, Paul Jackson; +Cc: linux-kernel
Hello guys, the following patch emphasizes on two things:
1. We can carry out the following function with one variable.
2. As hash_long returns with unsigned long we need a unsigned long to
handle this.
If anything else, please notice.
Thanks.
Signed-off-by: Md.Rakib H. Mullick (rakib.mullick@gmail.com)
--- linux-2.6.27-rc2.orig/kernel/cgroup.c 2008-08-06 16:23:26.000000000 +0600
+++ linux-2.6.27-rc2/kernel/cgroup.c 2008-08-08 19:06:53.000000000 +0600
@@ -200,17 +200,16 @@ static struct hlist_head css_set_table[C
static struct hlist_head *css_set_hash(struct cgroup_subsys_state *css[])
{
- int i;
- int index;
- unsigned long tmp = 0UL;
+ unsigned long tmp = 0UL , i;
for (i = 0; i < CGROUP_SUBSYS_COUNT; i++)
tmp += (unsigned long)css[i];
tmp = (tmp >> 16) ^ tmp;
- index = hash_long(tmp, CSS_SET_HASH_BITS);
+ i = 0;
+ i = hash_long(tmp, CSS_SET_HASH_BITS);
- return &css_set_table[index];
+ return &css_set_table[i];
}
/* We don't maintain the lists running through each css_set to its
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH] cgroup.c: Some 'hlist_head' function fixes.
2008-08-08 15:29 [PATCH] cgroup.c: Some 'hlist_head' function fixes Rakib Mullick
@ 2008-08-09 21:07 ` Paul Jackson
[not found] ` <b9df5fa10808100036h35e2c461je9139516f724687@mail.gmail.com>
0 siblings, 1 reply; 3+ messages in thread
From: Paul Jackson @ 2008-08-09 21:07 UTC (permalink / raw)
To: Rakib Mullick; +Cc: menage, linux-kernel
Rabik wrote:
> + i = 0;
> + i = hash_long(tmp, CSS_SET_HASH_BITS);
That "i = 0;" looks unnecessary to me, given
that i is unconditionally set again, on the
very next line.
--
I won't rest till it's the best ...
Programmer, Linux Scalability
Paul Jackson <pj@sgi.com> 1.940.382.4214
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH] cgroup.c: Some 'hlist_head' function fixes.
[not found] ` <20080811222942.a7998c43.pj@sgi.com>
@ 2008-08-12 12:12 ` Rakib Mullick
0 siblings, 0 replies; 3+ messages in thread
From: Rakib Mullick @ 2008-08-12 12:12 UTC (permalink / raw)
To: Paul Jackson; +Cc: linux-kernel
On 8/12/08, Paul Jackson <pj@sgi.com> wrote:
> > Is it [text size] the only criteria to judge this patch ?
>
> No - not the only criteria, as the patch combines a couple of
> changes.
>
> > What about the use of "unsigned long", instead of int.
>
> I had missed that change, even though you had explicitly
>
> described it in your patch comment, when you wrote:
>
> 2. As hash_long returns with unsigned long we need a unsigned long
>
>
> How about just casting the hash_long() result to int:
>
> index = (int)hash_long(tmp, CSS_SET_HASH_BITS);
Yes, it looks good.
>
> Since we are using this 'index' to index an array,
> it had better fit in an 'int', which indeed it does
> as CSS_SET_HASH_BITS is 7, which constrains the output
> of hash_long to [0 .. 2^7-1], that is between 0 and 127.
>
> However ... looking around the kernel, I see that most other
> uses of hash_long(), except in cases where the second argument
> (bit size) might actually exceed 32 bits, either directly
> index some array with the result, or else assign the result
> to a temporary 'int'.
>
> And the compiler does not complain that we're assigning a
> long to an int.
>
> So ... what's the problem?
Yes, maybe your right. Ok, I'll go through the code again. If it's
good then I'm happy.
>
> I see nothing in this patch of value.
>
> Am I missing something?
>
> -----
>
> I just noticed that you had dropped the other recipients
> from this email thread, a couple of replies ago. My
> preference would have been to have this discussion in
> public. I prefer not to drop people from CC lists on
> email threads.
Yes, I've noticed it too. I just forgot to do that. Actually, when I
reply to thread, I just think about that one. This could be a reason
for missing.
Thanks.
>
>
> --
>
> I won't rest till it's the best ...
> Programmer, Linux Scalability
> Paul Jackson <pj@sgi.com> 1.940.382.4214
>
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2008-08-12 12:12 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2008-08-08 15:29 [PATCH] cgroup.c: Some 'hlist_head' function fixes Rakib Mullick
2008-08-09 21:07 ` Paul Jackson
[not found] ` <b9df5fa10808100036h35e2c461je9139516f724687@mail.gmail.com>
[not found] ` <20080810220816.105d66ea.pj@sgi.com>
[not found] ` <b9df5fa10808110202w38930bb3oa492284f1c072f1f@mail.gmail.com>
[not found] ` <20080811222942.a7998c43.pj@sgi.com>
2008-08-12 12:12 ` Rakib Mullick
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
Powered by JetHome