From: Michal Hocko <mhocko@suse.com>
To: Sergey Senozhatsky <sergey.senozhatsky.work@gmail.com>
Cc: Tetsuo Handa <penguin-kernel@I-love.SAKURA.ne.jp>,
sergey.senozhatsky@gmail.com, pmladek@suse.com, pavel@ucw.cz,
rostedt@goodmis.org, andi@lisas.de, jack@suse.cz,
dri-devel@lists.freedesktop.org, linux-mm@kvack.org,
Daniel Vetter <daniel.vetter@ffwll.ch>
Subject: Re: printk: Should console related code avoid __GFP_DIRECT_RECLAIM memory allocations?
Date: Mon, 10 Jul 2017 15:33:15 +0200 [thread overview]
Message-ID: <20170710133314.GK19185@dhcp22.suse.cz> (raw)
In-Reply-To: <20170707023601.GA7478@jagdpanzerIV.localdomain>
On Fri 07-07-17 11:39:18, Sergey Senozhatsky wrote:
[...]
> > void drm_modeset_lock_all(struct drm_device *dev)
> > {
> > struct drm_mode_config *config = &dev->mode_config;
> > struct drm_modeset_acquire_ctx *ctx;
> > int ret;
> >
> > ctx = kzalloc(sizeof(*ctx), GFP_KERNEL);
> > if (WARN_ON(!ctx))
> > return;
>
> hm, this allocation, per se, looks ok to me. can't really blame it.
> what you had is a combination of factors
>
> CPU0 CPU1 CPU2
> console_callback()
> console_lock()
> ^^^^^^^^^^^^^
> vprintk_emit() mutex_lock(&par->bo_mutex)
> kzalloc(GFP_KERNEL)
> console_trylock() kmem_cache_alloc() mutex_lock(&par->bo_mutex)
> ^^^^^^^^^^^^^^^^ io_schedule_timeout
>
> // but I haven't seen the logs that you have provided, yet.
>
> [..]
> > As a result, console was not able to print SysRq-t output.
> >
> > So, how should we avoid this problem?
>
> from the top of my head -- console_sem must be replaced with something
> better.
Yeah, absolutely. The current mess just allows basically arbitrary lock
depencies which are not deadlocks because the printk part is careful but
essentially we are deadlocked wrt. functionality.
> but that's a task for years.
>
> hm...
>
> > But should fbcon, drm, tty and so on stop using __GFP_DIRECT_RECLAIM
> > memory allocations because consoles should be as responsive as printk() ?
>
> may be, may be not. like I said, the allocation in question does not
> participate in console output. it's rather hard to imagine how we would
> enforce a !__GFP_DIRECT_RECLAIM requirement here. it's console semaphore
> to blame, I think.
Agreed! Looking at the problem just from the page allocator perspective
is simply wrong. That is where you see your immediate problem because
that is what you are testing I would bet my hat you can find other
interesting scenarios if you try too hard...
--
Michal Hocko
SUSE Labs
--
To unsubscribe, send a message with 'unsubscribe linux-mm' in
the body to majordomo@kvack.org. For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"dont@kvack.org"> email@kvack.org </a>
prev parent reply other threads:[~2017-07-10 13:33 UTC|newest]
Thread overview: 13+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-07-06 10:28 Tetsuo Handa
2017-07-07 2:39 ` Sergey Senozhatsky
2017-07-07 8:41 ` Daniel Vetter
2017-07-08 13:30 ` Tetsuo Handa
2017-07-10 5:07 ` Sergey Senozhatsky
2017-07-10 12:59 ` Petr Mladek
2017-07-10 18:07 ` Daniel Vetter
2017-07-11 2:31 ` Sergey Senozhatsky
2017-07-11 4:57 ` Sergey Senozhatsky
2017-07-11 7:50 ` Daniel Vetter
2017-07-11 9:48 ` Sergey Senozhatsky
2017-07-11 11:36 ` Daniel Vetter
2017-07-10 13:33 ` Michal Hocko [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=20170710133314.GK19185@dhcp22.suse.cz \
--to=mhocko@suse.com \
--cc=andi@lisas.de \
--cc=daniel.vetter@ffwll.ch \
--cc=dri-devel@lists.freedesktop.org \
--cc=jack@suse.cz \
--cc=linux-mm@kvack.org \
--cc=pavel@ucw.cz \
--cc=penguin-kernel@I-love.SAKURA.ne.jp \
--cc=pmladek@suse.com \
--cc=rostedt@goodmis.org \
--cc=sergey.senozhatsky.work@gmail.com \
--cc=sergey.senozhatsky@gmail.com \
/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