RE: kmalloc within IRQ lock

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hi Guillaume,

kfree just returns pages to a pool, so I doubt you'll have problems there,
BUT
I would strongly suggest NOT to use IRQ locking on kmalloc/kfree:
Plus one more suggestion, IRQ locks disable interrupt lines, so make sure
your critical section is short
or you'll starve your system.

......
kmalloc()
spin_lock_irqsave()
...critical section....
spin_unlock_irqrestore()
kfree()

Regards,
Konstantyn

-----Original Message-----
From: Guillaume Thouvenin [mailto:guillaume.thouvenin@polymtl.ca]
Sent: Friday, May 07, 2004 4:38 AM
To: Kernel Newbies
Subject: RE: kmalloc within IRQ lock


Selon "Prokopenko, Konstantyn" <kproko@analogic.com>:

> Well, in theory you can generate dead-lock cituation. kmalloc with
> GFP_KERNEL flag in low memory condition
> can put "current" user to sleep waiting for swap daemon to free pages. I
> think I don't need to explain further what could happen if you have IRQ
lock
> around it.... It looks like a time bomb :)..

Is it the same for kfree?

Guillaume

--
Kernelnewbies: Help each other learn about the Linux kernel.
Archive:       http://mail.nl.linux.org/kernelnewbies/
FAQ:           http://kernelnewbies.org/faq/

--
Kernelnewbies: Help each other learn about the Linux kernel.
Archive:       http://mail.nl.linux.org/kernelnewbies/
FAQ:           http://kernelnewbies.org/faq/


[Index of Archives]     [Newbies FAQ]     [Linux Kernel Mentors]     [Linux Kernel Development]     [IETF Annouce]     [Git]     [Networking]     [Security]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux RAID]     [Linux SCSI]     [Linux ACPI]
  Powered by Linux