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


Groups > linux.kernel > #1336277

Re: [RFC PATCH 1/2] lib/percpu-list: Per-cpu list with associated per-cpu locks

From Peter Zijlstra <peterz@infradead.org>
Newsgroups linux.kernel
Subject Re: [RFC PATCH 1/2] lib/percpu-list: Per-cpu list with associated per-cpu locks
Date 2016-02-17 12:40 +0100
Message-ID <r38CC-5Js-13@gated-at.bofh.it> (permalink)
References (1 earlier) <r2ZfZ-7xT-21@gated-at.bofh.it> <r373R-4xY-37@gated-at.bofh.it> <r389z-5xF-11@gated-at.bofh.it> <r38jg-5Bd-15@gated-at.bofh.it> <r38sW-5EQ-1@gated-at.bofh.it>
Organization linux.* mail to news gateway

Show all headers | View raw


On Wed, Feb 17, 2016 at 12:26:54PM +0100, Peter Zijlstra wrote:
> On Wed, Feb 17, 2016 at 10:10:02PM +1100, Dave Chinner wrote:
> > On Wed, Feb 17, 2016 at 12:00:40PM +0100, Peter Zijlstra wrote:
> 
> > > Yeah, that is pretty terrible. Maybe a visitor interface is advisable?
> > > 
> > > visit_percpu_list_entries(struct percpu_list *head, void (*visitor)(struct list_head *pos, void *data), void *data)
> > > {
> > > 	int cpu;
> > > 
> > > 	for_each_possible_cpu(cpu) {
> > > 		spinlock_t *lock = per_cpu_ptr(&head->lock, cpu);
> > > 		struct list_head *head = per_cpu_ptr(&head->list, cpu);
> > > 		struct list_head *pos, *tmp;
> > > 
> > > 		spin_lock(lock);
> > > 		for (pos = head->next, tmp = pos->next; pos != head; pos = tmp)
> > > 			visitor(pos, data);
> > 
> > I thought about this - it's the same problem as the list_lru walking
> > functions. That is, the visitor has to be able to drop the list lock
> > to do blocking operations, so the lock has to be passed to the
> > visitor/internal loop context somehow, and the way the callers can
> > use it need to be documented.
> 
> But you cannot drop the lock and guarantee fwd progress. The moment you
> drop the lock, you have to restart the iteration from the head, since
> any iterator you had might now be pointing into space.

Ah, I see what iterate_bdevs() does. Yes, that's somewhat 'special'. Not
sure it makes sense to craft a generic 'interface' for that.

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


Thread

[RFC PATCH 1/2] lib/percpu-list: Per-cpu list with associated per-cpu locks Waiman Long <Waiman.Long@hpe.com> - 2016-02-17 02:40 +0100
  Re: [RFC PATCH 1/2] lib/percpu-list: Per-cpu list with associated  per-cpu locks Dave Chinner <david@fromorbit.com> - 2016-02-17 11:00 +0100
    Re: [RFC PATCH 1/2] lib/percpu-list: Per-cpu list with associated  per-cpu locks Peter Zijlstra <peterz@infradead.org> - 2016-02-17 12:10 +0100
      Re: [RFC PATCH 1/2] lib/percpu-list: Per-cpu list with associated  per-cpu locks Waiman Long <waiman.long@hpe.com> - 2016-02-17 17:20 +0100
        Re: [RFC PATCH 1/2] lib/percpu-list: Per-cpu list with associated  per-cpu locks Peter Zijlstra <peterz@infradead.org> - 2016-02-17 17:30 +0100
        Re: [RFC PATCH 1/2] lib/percpu-list: Per-cpu list with associated  per-cpu locks Christoph Lameter <cl@linux.com> - 2016-02-17 17:30 +0100
          Re: [RFC PATCH 1/2] lib/percpu-list: Per-cpu list with associated  per-cpu locks Peter Zijlstra <peterz@infradead.org> - 2016-02-17 18:20 +0100
            Re: [RFC PATCH 1/2] lib/percpu-list: Per-cpu list with associated  per-cpu locks Waiman Long <waiman.long@hpe.com> - 2016-02-17 18:50 +0100
              Re: [RFC PATCH 1/2] lib/percpu-list: Per-cpu list with associated  per-cpu locks Peter Zijlstra <peterz@infradead.org> - 2016-02-17 19:30 +0100
                Re: [RFC PATCH 1/2] lib/percpu-list: Per-cpu list with associated  per-cpu locks Waiman Long <waiman.long@hpe.com> - 2016-02-17 19:50 +0100
                Re: [RFC PATCH 1/2] lib/percpu-list: Per-cpu list with associated  per-cpu locks Peter Zijlstra <peterz@infradead.org> - 2016-02-17 20:40 +0100
          Re: [RFC PATCH 1/2] lib/percpu-list: Per-cpu list with associated  per-cpu locks Waiman Long <waiman.long@hpe.com> - 2016-02-17 18:20 +0100
    Re: [RFC PATCH 1/2] lib/percpu-list: Per-cpu list with associated  per-cpu locks Peter Zijlstra <peterz@infradead.org> - 2016-02-17 12:10 +0100
      Re: [RFC PATCH 1/2] lib/percpu-list: Per-cpu list with associated  per-cpu locks Dave Chinner <david@fromorbit.com> - 2016-02-17 12:20 +0100
        Re: [RFC PATCH 1/2] lib/percpu-list: Per-cpu list with associated  per-cpu locks Peter Zijlstra <peterz@infradead.org> - 2016-02-17 12:30 +0100
          Re: [RFC PATCH 1/2] lib/percpu-list: Per-cpu list with associated  per-cpu locks Peter Zijlstra <peterz@infradead.org> - 2016-02-17 12:40 +0100
    Re: [RFC PATCH 1/2] lib/percpu-list: Per-cpu list with associated  per-cpu locks Waiman Long <waiman.long@hpe.com> - 2016-02-17 17:00 +0100
      Re: [RFC PATCH 1/2] lib/percpu-list: Per-cpu list with associated  per-cpu locks Peter Zijlstra <peterz@infradead.org> - 2016-02-17 17:10 +0100
  Re: [RFC PATCH 1/2] lib/percpu-list: Per-cpu list with associated  per-cpu locks Christoph Lameter <cl@linux.com> - 2016-02-17 16:20 +0100

csiph-web