lkml.org 
[lkml]   [2010]   [Feb]   [12]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
DateSat, 13 Feb 2010 00:09:23 +0000
FromAlan Cox <>
SubjectRe: [2.6.33-rc7] tty: page allocation failure (from tty_buffer_request_room)
> > You are doing some output on console, for example write to a device /dev/tty.
> > Inside tty_buffer_request_room I found, that kmalloc was called and interrupts
> > are disabled. That means, memory can not swap out - if no free page is
> > available. tty_buffer_request_room checks for NULL returns. So, it assumes,
> > that kmalloc can fail. Unless they have forgotten to set __GFP_NOWARN. - Or it
> > is a defective design, and kmalloc should not called inside a spin_lock.


Neither - if we can't allocate a small buffer (and I would expect this to
be a small buffer of under one page) then we lose data and while we
continue to run it indicates a very serious low memory condition that the
user really ought to be aware of.

If anything what this says is that tty_insert_flip_string and friends
ought to be tweaked to do

nt tty_insert_flip_string(struct tty_struct *tty, const unsigned char
*chars, size_t size)
{
int copied = 0;
do {
int want = min(size - copied, TTY_BUFFER_PAGE);
int space = tty_buffer_request_room(tty, want);
...

where TTY_BUFFER_PAGE is defined to be the size to request so the buffer
will fit in one page of memory.



\
 
 \ /
  Last update: 2010-02-13 01:11    [from the cache]
©2003-2010