mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Alan Cox <alan@lxorguk.ukuu.org.uk>
To: Henry Nestler <henry-20071123@arcor.de>
Cc: linux-kernel@vger.kernel.org,
	"Frédéric L. W. Meunier" <fredlwm@gmail.com>,
	gregkh@suse.de, Simon.Richter@phobos.fachschaften.tu-muenchen.de
Subject: Re: [2.6.33-rc7] tty: page allocation failure (from tty_buffer_request_room)
Date: Sat, 13 Feb 2010 00:09:23 +0000	[thread overview]
Message-ID: <20100213000923.03007ddf@lxorguk.ukuu.org.uk> (raw)
In-Reply-To: <4B75E528.7090605@arcor.de>

> > 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.


      reply	other threads:[~2010-02-13  0:09 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <ed7v4-5Xl-13@gated-at.bofh.it>
2010-02-12 23:32 ` Henry Nestler
2010-02-13  0:09   ` Alan Cox [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20100213000923.03007ddf@lxorguk.ukuu.org.uk \
    --to=alan@lxorguk.ukuu.org.uk \
    --cc=Simon.Richter@phobos.fachschaften.tu-muenchen.de \
    --cc=fredlwm@gmail.com \
    --cc=gregkh@suse.de \
    --cc=henry-20071123@arcor.de \
    --cc=linux-kernel@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®