LWN.net Logo

Re: [PATCH 10/13] x86: Move cond resched for copy_{from,to}_user into low level code 64bit

From:  Linus Torvalds <torvalds-AT-linux-foundation.org>
To:  Andi Kleen <andi-AT-firstfloor.org>
Subject:  Re: [PATCH 10/13] x86: Move cond resched for copy_{from,to}_user into low level code 64bit
Date:  Sat, 10 Aug 2013 08:42:58 -0700
Message-ID:  <CA+55aFyN2Cnt=uQOnXszwDA971o=xEwO=yFSgL-RH9vRjMsBbg@mail.gmail.com>
Cc:  Linux Kernel Mailing List <linux-kernel-AT-vger.kernel.org>, "the arch/x86 maintainers" <x86-AT-kernel.org>, Ingo Molnar <mingo-AT-kernel.org>, Andi Kleen <ak-AT-linux.intel.com>
Archive-link:  Article, Thread

On Fri, Aug 9, 2013 at 4:04 PM, Andi Kleen <andi@firstfloor.org> wrote:
> From: Andi Kleen <ak@linux.intel.com>
>
> Move the cond_resched() check for CONFIG_PREEMPT_VOLUNTARY into
> the low level copy_*_user code. This avoids some code bloat and
> makes check much more efficient by avoiding unnecessary function calls.

May I suggest going one step further, and just removing the
cond_resched() _entirely_, leaving just the debug test?

There really is zero reason for doing a cond_resched() for user
accesses. If they take a page fault, then yes, by all means do that
(and maybe we should add one to the page fault trap if we don't have
it already), but without a page fault they really aren't that
expensive.

We do many more expensive things without any cond_resched(), and doing
that cond_resched() really doesn't make much sense *unless* there's a
big expensive loop involved.

Most of this series looks fine, but I really think that we
could/should just take that extra step, and say "no, user accesses
don't imply that we need to check for scheduling".

                    Linus


(Log in to post comments)

Copyright © 2013, Eklektix, Inc.
Comments and public postings are copyrighted by their creators.
Linux is a registered trademark of Linus Torvalds