lkml.org 
[lkml]   [2013]   [Sep]   [13]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
    /
    Date
    From
    SubjectRe: [PATCH 0/7] preempt_count rework -v2
    On Thu, Sep 12, 2013 at 04:20:40AM +0200, Peter Zijlstra wrote:
    > On Wed, Sep 11, 2013 at 04:02:14PM -0700, Linus Torvalds wrote:
    > > On Wed, Sep 11, 2013 at 11:59 AM, Peter Zijlstra <peterz@infradead.org> wrote:
    > > >
    > > > OK, stripped it down further, I couldn't quite see how to collapse the
    > > > unary and binary operator variants though :/
    > >
    > > Ok, this looks pretty good. I assume it works too? ;)
    >
    > Only compile tested that one.. the below is kvm boot tested until root
    > mount -- I'll try on actual hardware when I've gotten some sleep.
    >
    > I split the thing up into two macros GEN_UNARY_RMWcc and
    > GEN_BINARY_RMWcc which ends up being more readable as well as smaller
    > code overall.

    If you wanted to collapse the unary and binary variants as you mentioned
    upthread, you could do something like (for the CC_HAVE_ASM_GOTO case):

    #define GEN_RMWcc(fullop, cc, ...) \
    do { \
    asm volatile goto (fullop \
    "j" cc " %l[cc_label]" \
    : : __VA_ARGS__ \
    : "memory" : cc_label); \
    return 0; \
    cc_label: \
    return 1; \
    } while (0)

    #define GEN_UNARY_RMWcc(op, var, arg0, cc) GEN_RMWcc(op " " arg0 ";", cc, "m" (var))
    #define GEN_BINARY_RMWcc(op, var, val, arg0, cc) GEN_RMWcc(op " %1, " arg0 ";", cc, "m" (var), "er" (val))

    - Kevin


    \
     
     \ /
      Last update: 2013-09-13 10:01    [W:2.936 / U:0.288 seconds]
    ©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site