[lkml]   [2007]   [Mar]   [7]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
Messages in this thread
    SubjectRe: [patch] epoll use a single inode ...

    On Wed, 7 Mar 2007, Eric Dumazet wrote:
    > I was thinking about being able to cache the name into the dentry, do you
    > think it's worth the pain ? (its not SMP safe for example...)

    Actually, it *can* be SMP-safe, if you do it right. Something like

    len = dentry->d_name.len;

    if (!len) {
    len = snprintf(dentry->d_iname,
    dentry->d_name.len = len;
    if (len >= buflen)
    len = buflen-1;
    memcpy(buffer, dentry->d_iname, len);
    buffer[len] = 0;
    return buffer;

    should work, although it depends on the fact that our snprintf()
    implementation should be "stable" (ie if snprintf() modifies the buffer
    temporarily as it goes along, that would break, but I think our
    vsnprintf is good in that respect).

    So you could have two different CPU's doing the snprintf() on the same
    buffer at the same time (and assigning the length at the same time), but
    since they'll write the same thing, you don't really care.

    It's a bit subtle, though. And probably not really worth it.

    To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
    the body of a message to
    More majordomo info at
    Please read the FAQ at

     \ /
      Last update: 2007-03-07 20:11    [W:0.019 / U:13.568 seconds]
    ©2003-2017 Jasper Spaans. hosted at Digital OceanAdvertise on this site