lkml.org 
[lkml]   [2009]   [Oct]   [14]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
SubjectRe: How to check whether executing in atomic context?
From
On Thu, Oct 15, 2009 at 12:45 AM, Stefan Richter
<stefanr@s5r6.in-berlin.de> wrote:
> Leonidas . wrote:
>> On Wed, Oct 14, 2009 at 11:09 PM, Stefan Richter
>> <stefanr@s5r6.in-berlin.de> wrote:
>>> let the caller of your routine tell it whether it's atomic context
>>> or not.
> [...]
>> What makes it more complicated is this, the user might achieve the
>> functionality via instrumenting his source code, i.e. something like
>> using -finstrument flag of gcc. As per above inferences about
>> in_atomic(), in case of instrumentation there is no choice other than
>> providing all apis as atomic apis, this might not be the right thing
>> to do under all circumstances. Especially, for my code since I do lot
>> of allocations for book keeping.
>>
>> I am not aware of any Linux kernel module which can comply to this
>> kind of use case, what would be the most optimal thing to do here?
>
> And preallocation is not feasible either?
> --
> Stefan Richter
> -=====-==--= =-=- -===-
> http://arcgraph.de/sr/
>

Yes, I preallocate a buffer at module init time. But assume that, I am
profiling kmalloc(),
and number of kmallocs() done over time increases rapidly, I need to allocate
on demand as well depending on the load. (Actually, I am not profiling kmalloc,
it just makes a good example in this case). Currently, I preallocate a
large buffer
and as I reach the threshold, I try to grab small buffers as needed.
Obvious solution
here would be to grab a larger buffer, the only issue here would be it
might be just wasteful.

So, knowing the running context and allocating sounded like a better idea to me.

-Leo.


\
 
 \ /
  Last update: 2009-10-14 21:39    [W:3.864 / U:1.176 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site