thomas.jarosch at intra2net
Aug 20, 2007, 2:46 AM
Post #7 of 7
On Friday, 17. August 2007, Jan Engelhardt wrote:
Re: Memory allocation inside target handler
[In reply to]
> On Aug 17 2007 17:17, Thomas Jarosch wrote:
> >My question is now:
> >- Is it ok to use get_zeroed_page(GFP_ATOMIC) in interrupt context?
> I suppose so. There is code that checks for __GFP_WAIT.
> (GFP_ATOMIC has __GFP_WAIT _cleared_)
> >- Do I need some special locking before I can allocate memory inside
> > the target handler? Is f.e. kmalloc protected by some special locking?
> Only locking for your own structures, if needed.
> kmalloc alone does not. (You can write a memory leak without any locks, so
> to speak.)
ipt_ACCOUNT spinlocks the internal data structures, so that should be ok.
I've changed the code to allocate and free memory for every packet instead of
every read from userpace, now the machine survives only 10 seconds. To me it
looks like a missing locking in the kernel memory handler,
I'll try to get a backtrace via serial console.