[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] Re: [Xen-devel] [RFC] KEXEC: allocate crash note buffers at boot time v3
>>> On 01.12.11 at 14:59, Andrew Cooper <andrew.cooper3@xxxxxxxxxx> wrote: > On 01/12/11 12:56, Jan Beulich wrote: >> Further, you shouldn't take a lock around a call to xmalloc() or alike >> unless absolutely necessary. It is pretty simple to avoid here - you >> really only need to lock around the storing of the pointer and maybe >> the setup_note() calls (but be careful with returning -ENOMEM - you >> shouldn't if the allocation fails, but you then find - under the lock - >> that a pointer was already set by another CPU). > > So what we should do is this: > > xmalloc > take lock > check to see if the entry is been filled in the meantime. if so, free > the malloc'd region Don't call xfree() with the lock held either, if possible. > release lock > only return -ENOMEM if we fail the malloc and the crash_note is still > NULL when we take the lock Jan _______________________________________________ Xen-devel mailing list Xen-devel@xxxxxxxxxxxxxxxxxxx http://lists.xensource.com/xen-devel
|
![]() |
Lists.xenproject.org is hosted with RackSpace, monitoring our |