Re: [PATCH 01/13] AppArmor: misc. base functions and defines
From: Pekka Enberg
Date: Fri Jul 30 2010 - 06:53:53 EST
On Fri, Jul 30, 2010 at 1:01 PM, John Johansen
<john.johansen@xxxxxxxxxxxxx> wrote:
>>> +/**
>>> + * kvfree - free an allocation do by kvmalloc
>>> + * @buffer: buffer to free (MAYBE_NULL)
>>> + *
>>> + * Free a buffer allocated by kvmalloc
>>> + */
>>> +void kvfree(void *buffer)
>>> +{
>>> + if (is_vmalloc_addr(buffer)) {
>>> + /* Data is no longer valid so just use the allocated space
>>> + * as the work_struct
>>> + */
>>> + struct work_struct *work = (struct work_struct *) buffer;
>>> + INIT_WORK(work, do_vfree);
>>> + schedule_work(work);
>>
>> I don't understand this part here. Is it needed for interrupt contexts
>> or does vfree() sleep somewhere? If it's for the former, I think we
>> can just add a comment saying that kvmalloc/kvfree is not safe from
>> interrupt context and remove the schedule_work() parts here.
>
> vfree can sleep, and skipping the schedule_work parts won't work for
> apparmor as many of these allocations are being freed via rcu callbacks
> as most of our object life cycles are dependent on cred refcounting.
Can someone point me to where vfree() actually sleeps? I'm unable to
find the exact spot.
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/