[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <AANLkTimYK_4PcVrAniOE3pQjgYNwYNjI6q8p1FMZntEa@mail.gmail.com>
Date: Tue, 6 Jul 2010 12:31:21 +0400
From: Dan Kruchinin <dkruchinin@....org>
To: Steffen Klassert <steffen.klassert@...unet.com>
Cc: LKML <linux-kernel@...r.kernel.org>,
Herbert Xu <herbert@...dor.apana.org.au>
Subject: Re: [PATCH 1/3] padata: separate serial and parallel cpumasks
On Tue, Jul 6, 2010 at 11:46 AM, Steffen Klassert
<steffen.klassert@...unet.com> wrote:
> On Tue, Jul 06, 2010 at 11:40:11AM +0400, Dan Kruchinin wrote:
>> >> >
>> >>
>> >> I think we can use RCU anyway. For instance we could use a structure
>> >>
>> >> struct pcrypt_cpumask {
>> >> cpumask_var_t pmask;
>> >> cpumask_var_t smask;
>> >> };
>> >>
>> >> and add a pointer to a structure of that type to the instance context.
>> >> Then we could use this pointer for RCU and replace the whole structure
>> >> if a cpumask changes.
>>
>> But is pcrypt interested pmask? If it isn't, pmask field will be unused.
>>
>
> It's probaply not, in this case the struct could look like
>
> struct pcrypt_cpumask {
> cpumask_var_t smask;
> };
>
Would't it be the same as with a pointer to cpumask_var_t? I mean:
struct pcrypt {
...
struct pcrypt_cpumask *mask;
...
} pencrypt;
To assign a pointer via RCU:
int cpumask_change_nitify(...) {
...
struct pcrypt_cpumask *new_mask = kmalloc(sizeof(*mask), GFP);
struct pcrypt_cpumask *old_mask = pencrypt.mask;
if (!new_mask)
error();
if (!alloc_cpumask_var(&new_mask->smask, GFP_KERNEL))
error();
get_serial_cpumask_from_padata(new_mask->mask);
rcu_assign_pointer(pencrypt.mask, new_mask);
synchronize_rcu_bh();
free_cpumask_var(old_mask->smask);
kfree(old_mask);
...
}
It's a bit hard to read this code because at the first sight it
appears unclear and odd why we allocate the structure with only one
member.
--
W.B.R.
Dan Kruchinin
--
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