All of lore.kernel.org
 help / color / mirror / Atom feed
From: Don Mullis <don.mullis@gmail.com>
To: dedekind@infradead.org
Cc: Andi Kleen <andi@firstfloor.org>,
	linux-kernel@vger.kernel.org, airlied@redhat.com,
	david@fromorbit.com
Subject: Re: [PATCH 1/2] lib: more scalable list_sort()
Date: Fri, 22 Jan 2010 09:55:39 -0800	[thread overview]
Message-ID: <87my0681no.fsf@gmail.com> (raw)
In-Reply-To: <1264163348.3032.240.camel@localhost> (Artem Bityutskiy's message of "Fri, 22 Jan 2010 14:29:08 +0200")

Artem Bityutskiy <dedekind@infradead.org> writes:

> On Fri, 2010-01-22 at 11:43 +0100, Andi Kleen wrote:
>> Don Mullis <don.mullis@gmail.com> writes:
>> >
>> > Being just a dumb library routine, list_sort() has no idea what context
>> > it's been called in, how long a list a particular client could pass in,
>> > nor how expensive the client's cmp() callback might be.
>> >
>> > The cmp() callback already passes back a client-private pointer.
>> > Hanging off of this could be a count of calls, or timing information,
>> > maintained by the client.  Whenever some threshold is reached, the
>> > client's cmp() could do whatever good CPU-sharing citizenship required.
>> 
>> need_resched() does all the timing/thresholding (it checks the 
>> reschedule flag set by the timer interrupt). You just have to call it.
>> But preferable not in the inner loop, but in a outer one. It's
>> not hyper-expensive, but it's not free either.
>> 
>> The drawback is that if it's called the context always has to
>> allow sleeping, so it might need to be optional.
>> 
>> Anyways a better fix might be simply to ensure in the caller
>> that lists never get as long that they become a scheduling
>> hazard. But you indicated that ubifs would pass very long lists?
>> Perhaps ubifs (and other calls who might have that problem) simply
>> needs to be fixed.
>
> No, they are not very long. A hundred or so I guess, rarely. But we need
> to check what is really the worst case, but it should not be too many.

I suggest for now we leave scheduling issues as the caller's
responsibility, and keep list_sort() simple.  Wouldn't want to be
getting any email like this:

         http://lwn.net/Articles/366768/

  reply	other threads:[~2010-01-22 17:55 UTC|newest]

Thread overview: 22+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-01-21  4:51 [PATCH 1/2] lib: more scalable list_sort() Don Mullis
2010-01-21  5:17 ` [PATCH 2/2] lib: revise list_sort() comment Don Mullis
2010-01-21 19:11   ` Olaf Titz
2010-01-22  4:54     ` Don Mullis
2010-01-21  9:22 ` [PATCH 1/2] lib: more scalable list_sort() Artem Bityutskiy
2010-01-21  9:54   ` Dave Chinner
2010-01-21 11:44     ` Artem Bityutskiy
2010-01-21 16:34       ` Don Mullis
2010-01-21 17:59 ` Andi Kleen
2010-01-22  3:17   ` Don Mullis
2010-01-22 10:43     ` Andi Kleen
2010-01-22 12:29       ` Artem Bityutskiy
2010-01-22 17:55         ` Don Mullis [this message]
2010-01-23  8:28       ` Dave Chinner
2010-01-23 11:35         ` Andi Kleen
2010-01-23 16:05           ` Dave Chinner
2010-01-24 20:59             ` Andi Kleen
2010-01-24 21:10               ` Artem Bityutskiy
2010-01-24 22:38                 ` Don Mullis
2010-01-25  3:41               ` Dave Chinner
2010-08-04 14:04 ` Artem Bityutskiy
2010-08-07  7:50   ` Artem Bityutskiy

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=87my0681no.fsf@gmail.com \
    --to=don.mullis@gmail.com \
    --cc=airlied@redhat.com \
    --cc=andi@firstfloor.org \
    --cc=david@fromorbit.com \
    --cc=dedekind@infradead.org \
    --cc=linux-kernel@vger.kernel.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.