mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: "Paul E. McKenney" <paulmck@us.ibm.com>
To: Eric Dumazet <dada1@cosmosbay.com>
Cc: dipankar@in.ibm.com, Linus Torvalds <torvalds@osdl.org>,
	Jean Delvare <khali@linux-fr.org>,
	Serge Belyshev <belyshev@depni.sinp.msu.ru>,
	LKML <linux-kernel@vger.kernel.org>,
	Andrew Morton <akpm@osdl.org>,
	Manfred Spraul <manfred@colorfullife.com>
Subject: Re: VFS: file-max limit 50044 reached
Date: Mon, 17 Oct 2005 15:59:26 -0700	[thread overview]
Message-ID: <20051017225925.GB1298@us.ibm.com> (raw)
In-Reply-To: <4353E6F1.8030206@cosmosbay.com>

On Mon, Oct 17, 2005 at 08:01:21PM +0200, Eric Dumazet wrote:
> Dipankar Sarma a écrit :
> >On Mon, Oct 17, 2005 at 09:16:25AM -0700, Linus Torvalds wrote:
> >
> >>>Absolutely. Keeping a count of (percpu) queued items is basically free 
> >>>if kept
> >>>in the cache line used by list head, so the 'queue length on this cpu' 
> >>>is a
> >>>cheap metric.
> >>
> >>The only downside to TIF_RCUUPDATE is that those damn TIF-flags are 
> >>per-architecture (probably largely unnecessary, but while most 
> >>architectures don't care at all, others seem to have optimized their 
> >>layout so that they can test the work bits more efficiently). So it's a 
> >>matter of each architecture being updated with its TIF_xyz flag and their 
> >>work function.
> >>
> >>Anybody willing to try? Dipankar apparently has a lot on his plate, this 
> >>_should_ be fairly straightforward. Eric?
> >
> >
> >I *had*, when this hit me :) It was one those spurt things. I am going to
> >look at this, but I think we will need to do this with some careful
> >benchmarking.
> >
> >At the moment however I do have another concern - open/close taking too
> >much time as I mentioned in an earlier email. It is nearly 4 times
> >slower than 2.6.13. So, that is first up in my list of things to
> >do at the moment.
> >
> 
> <lazy_mode=ON>
> Do we really need a TIF_RCUUPDATE flag, or could we just ask for a resched ?
> </lazy_mode>
> 
> This patch only take care of call_rcu(), I'm unsure of what can be done 
> inside call_rcu_bh()
> 
> The two stress program dont hit OOM anymore with this patch applied (even 
> with maxbatch=10)

Keeping the per-CPU count of queued callbacks seems eminently reasonable
to me, as does the set_need_resched().  But the proposed (but fortunately
commented out) call of rcu_do_batch() from call_rcu() does have deadlock
issues.

> Eric
> 

> --- linux-2.6.14-rc4/kernel/rcupdate.c	2005-10-11 03:19:19.000000000 +0200
> +++ linux-2.6.14-rc4-ed/kernel/rcupdate.c	2005-10-17 21:52:18.000000000 +0200
> @@ -109,6 +109,10 @@
>  	rdp = &__get_cpu_var(rcu_data);
>  	*rdp->nxttail = head;
>  	rdp->nxttail = &head->next;
> +
> +	if (unlikely(++rdp->count > 10000))
> +		set_need_resched();
> +
>  	local_irq_restore(flags);
>  }
>  
> @@ -140,6 +144,12 @@
>  	rdp = &__get_cpu_var(rcu_bh_data);
>  	*rdp->nxttail = head;
>  	rdp->nxttail = &head->next;
> +	rdp->count++;

Really need an "rdp->count++" in call_rcu_bh() as well, otherwise
the _bh struct rcu_data will have a steadily decreasing count field.
Strictly speaking, this is harmless, since call_rcu_bh() cheerfully
ignores this field, but this situation is bound to cause severe confusion
at some point.

> +/*
> + *  Should we directly call rcu_do_batch() here ?
> + *  if (unlikely(rdp->count > 10000))
> + *      rcu_do_batch(rdp);
> + */

Good thing that the above is commented out!  ;-)

Doing this can result in self-deadlock, for example with the following:

	spin_lock(&mylock);
	/* do some stuff. */
	call_rcu(&p->rcu_head, my_rcu_callback);
	/* do some more stuff. */
	spin_unlock(&mylock);

void my_rcu_callback(struct rcu_head *p)
{
	spin_lock(&mylock);
	/* self-deadlock via call_rcu() via rcu_do_batch()!!! */
	spin_unlock(&mylock);
}


						Thanx, Paul

>  }
>  
> @@ -157,6 +167,7 @@
>  		next = rdp->donelist = list->next;
>  		list->func(list);
>  		list = next;
> +		rdp->count--;
>  		if (++count >= maxbatch)
>  			break;
>  	}
> --- linux-2.6.14-rc4/include/linux/rcupdate.h	2005-10-11 03:19:19.000000000 +0200
> +++ linux-2.6.14-rc4-ed/include/linux/rcupdate.h	2005-10-17 21:02:25.000000000 +0200
> @@ -94,6 +94,7 @@
>  	long  	       	batch;           /* Batch # for current RCU batch */
>  	struct rcu_head *nxtlist;
>  	struct rcu_head **nxttail;
> +	long            count; /* # of queued items */
>  	struct rcu_head *curlist;
>  	struct rcu_head **curtail;
>  	struct rcu_head *donelist;


  parent reply	other threads:[~2005-10-17 22:58 UTC|newest]

Thread overview: 48+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2005-10-15 13:19 Serge Belyshev
2005-10-15 17:53 ` Serge Belyshev
2005-10-16 16:23   ` Dipankar Sarma
2005-10-16 18:51     ` Serge Belyshev
2005-10-16 18:56       ` Dipankar Sarma
2005-10-17  2:19         ` Linus Torvalds
2005-10-17  4:43           ` Serge Belyshev
2005-10-17  8:32           ` Jean Delvare
2005-10-17  8:46             ` Dipankar Sarma
2005-10-17  9:10               ` Eric Dumazet
2005-10-17  9:14                 ` Christoph Hellwig
2005-10-17  9:25                   ` Eric Dumazet
2005-10-17 10:32                 ` Dipankar Sarma
2005-10-17 12:10                   ` [RCU problem] was " Eric Dumazet
2005-10-17 12:31                     ` linux-os (Dick Johnson)
2005-10-17 12:36                     ` Dipankar Sarma
2005-10-17 13:28                       ` Eric Dumazet
2005-10-17 13:33                         ` Dipankar Sarma
2005-10-17 14:54                         ` Eric Dumazet
2005-10-17 15:42                   ` Linus Torvalds
2005-10-17 16:01                     ` Eric Dumazet
2005-10-17 16:16                       ` Linus Torvalds
2005-10-17 16:29                         ` Dipankar Sarma
2005-10-17 18:01                           ` Eric Dumazet
2005-10-17 18:31                             ` Dipankar Sarma
2005-10-17 19:00                               ` Linus Torvalds
2005-10-17 18:37                             ` Linus Torvalds
2005-10-17 19:12                               ` Eric Dumazet
2005-10-17 19:30                                 ` Linus Torvalds
2005-10-17 19:39                                   ` Eric Dumazet
2005-10-17 20:14                                     ` Linus Torvalds
2005-10-17 20:25                                       ` Christopher Friesen
2005-10-17 20:24                                         ` Dipankar Sarma
2005-10-18 15:55                                           ` Christopher Friesen
2005-10-17 20:38                                         ` Linus Torvalds
2005-10-17 20:33                                       ` Dipankar Sarma
2005-10-17 22:40                                       ` Linus Torvalds
2005-10-17 22:59                             ` Paul E. McKenney [this message]
2005-10-18  9:46                               ` Eric Dumazet
2005-10-18 16:22                                 ` Paul E. McKenney
2005-10-17 18:15                           ` Dipankar Sarma
2005-10-17 18:40                           ` Linus Torvalds
2005-10-17 16:23                       ` Dipankar Sarma
2005-10-17 16:31                       ` Lee Revell
2005-10-17 16:20                     ` Dipankar Sarma
2005-10-17  2:34     ` Linus Torvalds
2005-10-17  3:54       ` Roland Dreier
2005-10-17 11:54       ` Dipankar Sarma

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=20051017225925.GB1298@us.ibm.com \
    --to=paulmck@us.ibm.com \
    --cc=akpm@osdl.org \
    --cc=belyshev@depni.sinp.msu.ru \
    --cc=dada1@cosmosbay.com \
    --cc=dipankar@in.ibm.com \
    --cc=khali@linux-fr.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=manfred@colorfullife.com \
    --cc=torvalds@osdl.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®