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


Groups > linux.kernel > #1332535

Re: [RFC][PATCH v3 4/4] printk: set may_schedule for some of console_trylock callers

From Sergey Senozhatsky <sergey.senozhatsky@gmail.com>
Newsgroups linux.kernel
Subject Re: [RFC][PATCH v3 4/4] printk: set may_schedule for some of console_trylock callers
Date 2016-02-12 06:20 +0100
Message-ID <r1ej7-2t1-1@gated-at.bofh.it> (permalink)
References <qU1Al-8nr-3@gated-at.bofh.it> <qU1Am-8nr-15@gated-at.bofh.it> <r10Jc-1HE-33@gated-at.bofh.it> <r112z-23q-23@gated-at.bofh.it> <r128i-2LZ-13@gated-at.bofh.it>
Organization linux.* mail to news gateway

Show all headers | View raw


On (02/11/16 17:10), Petr Mladek wrote:
[..]
> > well, I believe it's ok. __rcu_read_lock() for CONFIG_PREEMPT_RCU
> > does current->rcu_read_lock_nesting++, so rcu_preempt_depth() works
> > as expected. otherwise, for !CONFIG_PREEMPT_RCU kernel,
> > __rcu_read_lock() does
> > 
> > 	if (IS_ENABLED(CONFIG_PREEMPT_COUNT))
> > 		preempt_disable()
> > 
> > 
> > - if we run "CONFIG_PREEMPT_RCU" then rcu_preempt_depth()
> >   works here.
> > 
> > - if we run "!CONFIG_PREEMPT_RCU && CONFIG_PREEMPT_COUNT"
> >   then preemptible() works for us
> > 
> > - if we run "!CONFIG_PREEMPT_RCU && !CONFIG_PREEMPT_COUNT"
> >   then preemptible() is always 0.
> 
> I feel convinced. But we should somehow document it. I think how
> to do it effectively. I think that the following text would help
> me if I read it:
> 
> 	/*
> 	 * Safe context for rescheduling is detected only when
> 	 * PREEMPT_COUNT is enabled. preemptible() always returns
> 	 * false otherwise.
> 	 *
> 	 * RCU read sections must be detected separately. They
> 	 * have a separate preemption counter when PREEMPT_RCU
> 	 * is enabled.
> 	 */
> 
> I wanted to highlight why exactly the check returns 0 in !PREEMPT_COUNT
> kernel. I missed this a bit in you original comment. But feel free
> to change it as you like.

good point. thanks! will re-spin the patch set later today,
have no reliable internet connection at the moment.

	-ss

Back to linux.kernel | Previous | NextPrevious in thread | Find similar | Unroll thread


Thread

Re: [RFC][PATCH v3 4/4] printk: set may_schedule for some of  console_trylock callers Petr Mladek <pmladek@suse.com> - 2016-02-11 15:50 +0100
  Re: [RFC][PATCH v3 4/4] printk: set may_schedule for some of  console_trylock callers Sergey Senozhatsky <sergey.senozhatsky@gmail.com> - 2016-02-11 16:10 +0100
    Re: [RFC][PATCH v3 4/4] printk: set may_schedule for some of  console_trylock callers Petr Mladek <pmladek@suse.com> - 2016-02-11 17:20 +0100
      Re: [RFC][PATCH v3 4/4] printk: set may_schedule for some of  console_trylock callers Sergey Senozhatsky <sergey.senozhatsky@gmail.com> - 2016-02-12 06:20 +0100

csiph-web