[lkml]   [2011]   [Jun]   [25]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
Messages in this thread
    SubjectRe: [PATCH v2] futex: Fix regression with read only mappings
    >> commit 7485d0d3758e8e6491a5c9468114e74dc050785d (futexes: Remove rw
    >> parameter from get_futex_key()) in 2.6.33 introduced a user-mode
    >> regression in that it additionally prevented futex operations on a
    >> region within a read only memory mapped file.  For example this breaks
    >> workloads that have one or more reader processes doing a FUTEX_WAIT on a
    >> futex within a read only shared mapping, and a writer processes that has
    >> a writable mapping issuing the FUTEX_WAKE.
    >> This fixes the regression for futex operations that should be valid on
    >> RO mappings by trying a RO get_user_pages_fast() when the RW
    >> get_user_pages_fast() fails so as not to slow down the common path of
    >> writable anonymous maps and bailing when we used the RO path on
    >> anonymous memory.
    > The goal here is to bail with EFAULT when we use a RO MAP_PRIVATE
    > mapping on file-backed memory correct?

    The problem is, mapping knowledge is contained vma and it's required mma_sem
    (ie performance hurt). Therefore we have only three ways, maybe.

    1) always take mmap_sem and walk vma, likes 2.6.18. (cons. slow)
    2) prefault, likes current linus-tree. (cons don't work RO mappings)
    3) combination prefault and mmap_sem. likes my previous post.

    In other words, you hope to care RO private mapping thing, you can't avoid
    mmap_sem anymore. unfortunatelly. So, we have to select either cons.

    > Final concern:
    > Are shared memory segments (shmget, etc.) considered "file backed?

    It's another corner case. It similar with shared file mapping, but,

    PageSwapBacked(page) => 1
    PageAnon(page) => 0

    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: 2011-06-25 17:15    [W:0.025 / U:7.120 seconds]
    ©2003-2016 Jasper Spaans. hosted at Digital OceanAdvertise on this site