Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1676650 > unrolled thread

Re: [RFC][PATCHv3 2/5] printk: introduce printing kernel thread

Started byPetr Mladek <pmladek@suse.com>
First post2017-06-28 15:20 +0200
Last post2017-06-29 09:50 +0200
Articles 2 — 2 participants

Back to article view | Back to linux.kernel

This discussion starts older than the indexed window; earlier articles aren't shown. The article labeled Started by below is the oldest one visible, not the original post.


Contents

  Re: [RFC][PATCHv3 2/5] printk: introduce printing kernel thread Petr Mladek <pmladek@suse.com> - 2017-06-28 15:20 +0200
    Re: [RFC][PATCHv3 2/5] printk: introduce printing kernel thread Sergey Senozhatsky <sergey.senozhatsky.work@gmail.com> - 2017-06-29 09:50 +0200

#1676650 — Re: [RFC][PATCHv3 2/5] printk: introduce printing kernel thread

FromPetr Mladek <pmladek@suse.com>
Date2017-06-28 15:20 +0200
SubjectRe: [RFC][PATCHv3 2/5] printk: introduce printing kernel thread
Message-ID<tXl2W-7fD-25@gated-at.bofh.it>
On Thu 2017-06-01 16:21:02, Sergey Senozhatsky wrote:
> On (05/31/17 16:30), Sergey Senozhatsky wrote:
> > On (05/29/17 14:12), Jan Kara wrote:
> > [..]
> > > Actually I had something very similar in old versions of my patch set. And
> > > it didn't work very well. The problem was that e.g. sometimes scheduler
> > > decided that printk kthread should run on the same CPU as the process
> > > currently doing printing and in such case printk kthread never took over
> > > printing and the machine locked up due to heavy printing.
> > 
> > hm, interesting.
> 
> that's a tricky problem to deal with.
> 
> 
> 
> ... so may be we can have per-CPU printk kthreads then
> 
> 	static DEFINE_PER_CPU(struct task_struct *, printk_kthread);
> 
> 
> SMP hotplug threads, to be precise, the same way as watchdog has it. and
> then during offloading we can wake_up any printk_kthread that is knowingly
> not from this-CPU, all of them, let them compete for the console_sem.
> 
> just a quick idea.
> 
> thoughts?

I am not sure if this is worth the resources. It think that one
big win of workqueues was that it reduced the amount of running
per-CPU kthreads. There are systems with thousands of CPUs.

I am a bit afraid to use workqueues for flushing consoles.
It would be another dependency and another risk.

Otherwise, per-CPU kthreads/workqueues primary handle per-CPU
resources. But printk_kthread would handle consoles that
need to be serialized anyway. It sounds weird to have
per-CPU task just to increase the chance that it will
get scheduled.

Best Regards,
Petr

[toc] | [next] | [standalone]


#1677498

FromSergey Senozhatsky <sergey.senozhatsky.work@gmail.com>
Date2017-06-29 09:50 +0200
Message-ID<tXCn9-4LC-21@gated-at.bofh.it>
In reply to#1676650
On (06/28/17 15:17), Petr Mladek wrote:
> On Thu 2017-06-01 16:21:02, Sergey Senozhatsky wrote:
> > On (05/31/17 16:30), Sergey Senozhatsky wrote:
> > > On (05/29/17 14:12), Jan Kara wrote:
> > > [..]
> > > > Actually I had something very similar in old versions of my patch set. And
> > > > it didn't work very well. The problem was that e.g. sometimes scheduler
> > > > decided that printk kthread should run on the same CPU as the process
> > > > currently doing printing and in such case printk kthread never took over
> > > > printing and the machine locked up due to heavy printing.
> > > 
> > > hm, interesting.
> > 
> > that's a tricky problem to deal with.
> > 
> > 
> > 
> > ... so may be we can have per-CPU printk kthreads then
> > 
> > 	static DEFINE_PER_CPU(struct task_struct *, printk_kthread);
> > 
> > 
> > SMP hotplug threads, to be precise, the same way as watchdog has it. and
> > then during offloading we can wake_up any printk_kthread that is knowingly
> > not from this-CPU, all of them, let them compete for the console_sem.
> > 
> > just a quick idea.
> > 
> > thoughts?
> 
> I am not sure if this is worth the resources. It think that one
> big win of workqueues was that it reduced the amount of running
> per-CPU kthreads. There are systems with thousands of CPUs.
> 
> I am a bit afraid to use workqueues for flushing consoles.
> It would be another dependency and another risk.
> 
> Otherwise, per-CPU kthreads/workqueues primary handle per-CPU
> resources. But printk_kthread would handle consoles that
> need to be serialized anyway. It sounds weird to have
> per-CPU task just to increase the chance that it will
> get scheduled.

yeah. was just a quick idea. it has some 'interesting' options, tho.
I'll reply in another thread.

the waste of resources argument is somewhat interesting. I'm not
arguing, and agree that per-CPU kthread for printk seems like a
massive-massive overkill. the point is - I think that 99.999% of
the time printk_safe and printk_nmi buffers are not needed. they
simply waste memory. on a $BIG systems that's, once again, can be
huge. so in terms of resources printk probably must do better,
already.

	-ss

[toc] | [prev] | [standalone]


Back to top | Article view | linux.kernel


csiph-web