mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Russell King <rmk+lkml@arm.linux.org.uk>
To: Daniel Walker <dwalker@mvista.com>
Cc: linux-kernel@vger.kernel.org
Subject: Re: Interrupt starvation points
Date: Fri, 11 Feb 2005 20:04:24 +0000	[thread overview]
Message-ID: <20050211200424.B28971@flint.arm.linux.org.uk> (raw)
In-Reply-To: <1108141521.21940.44.camel@dhcp153.mvista.com>; from dwalker@mvista.com on Fri, Feb 11, 2005 at 09:05:21AM -0800

On Fri, Feb 11, 2005 at 09:05:21AM -0800, Daniel Walker wrote:
>         The other patch enabled interrupt before calling up on
> kernel_sem ..This one could use some thinking over. I did this cause
> up() is very expensive on ARM , and combined with the looping above
> interrupts can stay off for a long time .. 

Please substantiate your claim that up() is very expensive on ARM.
I disagree:

#define __up_op(ptr,wake)                       \
        ({                                      \
        __asm__ __volatile__(                   \
        "@ up_op\n"                             \
"       mrs     ip, cpsr\n"                     \
"       orr     lr, ip, #128\n"                 \
"       msr     cpsr_c, lr\n"                   \
"       ldr     lr, [%0]\n"                     \
"       adds    lr, lr, %1\n"                   \
"       str     lr, [%0]\n"                     \
"       msr     cpsr_c, ip\n"                   \
"       movle   ip, %0\n"                       \
"       blle    " #wake                         \
        :                                       \
        : "r" (ptr), "I" (1)                    \
        : "ip", "lr", "cc", "memory");          \
        })

static inline void up(struct semaphore * sem)
{
        __up_op(sem, __up_wakeup);
}

Looks like 9 instructions for the uncontended case to me.  If you're
worried about 9 instructions being expensive, please work on GCC to
improve its optimisation capabilities first.  There's room there for
improvement across the whole kernel than just the above 9 instructions.

Plus, after you've read the above code, wouldn't you think that adding
the "enable interrupts + disable interrupts" around an up() operation
(which itself immediately disables interrupts again) is just adding
extra instructions to the kernel, which corresponds directly to lower
performance?

-- 
Russell King
 Linux kernel    2.6 ARM Linux   - http://www.arm.linux.org.uk/
 maintainer of:  2.6 PCMCIA      - http://pcmcia.arm.linux.org.uk/
                 2.6 Serial core

  parent reply	other threads:[~2005-02-11 21:14 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2005-02-11 17:05 Daniel Walker
2005-02-11 17:30 ` Ingo Molnar
2005-02-11 17:36   ` Daniel Walker
2005-02-11 20:04 ` Russell King [this message]
2005-02-11 21:52   ` Daniel Walker

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=20050211200424.B28971@flint.arm.linux.org.uk \
    --to=rmk+lkml@arm.linux.org.uk \
    --cc=dwalker@mvista.com \
    --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 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®