[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20191120161334.p63723g4jyk6k7p3@pathway.suse.cz>
Date: Wed, 20 Nov 2019 17:13:34 +0100
From: Petr Mladek <pmladek@...e.com>
To: Sergey Senozhatsky <sergey.senozhatsky@...il.com>
Cc: Sergey Senozhatsky <sergey.senozhatsky.work@...il.com>,
Qian Cai <cai@....pw>, Steven Rostedt <rostedt@...dmis.org>,
Michal Hocko <mhocko@...nel.org>,
Eric Dumazet <eric.dumazet@...il.com>, davem@...emloft.net,
netdev@...r.kernel.org, linux-mm@...ck.org,
linux-kernel@...r.kernel.org
Subject: Re: [PATCH] net/skbuff: silence warnings under memory pressure
On Wed 2019-11-20 10:30:05, Sergey Senozhatsky wrote:
> On (19/11/19 10:41), Petr Mladek wrote:
> [..]
> > > > I do not like this. As a result, normal printk() will always deadlock
> > > > in the scheduler code, including WARN() calls. The chance of the
> > > > deadlock is small now. It happens only when there is another
> > > > process waiting for console_sem.
> > >
> > > Why would it *always* deadlock? If this is the case, why we don't *always*
> > > deadlock doing the very same wake_up_process() from console_unlock()?
> >
> > I speak about _normal_ printk() and not about printk_deferred().
> >
> > wake_up_process() is called in console_unlock() only when
> > sem->wait_list is not empty, see up() in kernel/locking/semaphore.c.
> > printk() itself uses console_trylock() and does not wait.
>
> > I believe that this is the rason why printk_sched() was added
> > so late in 2012.
>
> Right. I also think scheduler people do pretty nice work avoiding printk
> calls under ->rq lock.
>
> What I tried to say - it's really not that hard to have a non-empty
> console_sem ->wait_list, any "wrong" printk() call from scheduler
> will deadlock us, because we have something to wake_up().
I am sorry but I do not take this as an argument that it would be
acceptable to replace irq_work_queue() with wake_up_interruptible().
It is the first time that I hear about problem caused by the
irq_work(). But we deal with deadlocks caused by wake_up() for years.
It would be like replacing a lightly dripping tap with a heavily
dripping one.
I see reports with WARN() from scheduler code from time to time.
I would get reports about silent death instead.
RT guys are going to make printk() fully lockless. It would be
really great achievement. irq_work is lockless. While wake_up()
is not.
There must be a better way how to break the infinite loop caused
by the irq_work.
Best Regards,
Petr
Powered by blists - more mailing lists