lkml.org 
[lkml]   [2013]   [Jun]   [13]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
    /
    Date
    From
    SubjectRe: [PATCH] mm: Revert pinned_vm braindamage
    Let's try to get this wrapped up?

    On Thu, 6 Jun 2013 14:43:51 +0200 Peter Zijlstra <peterz@infradead.org> wrote:

    >
    > Patch bc3e53f682 ("mm: distinguish between mlocked and pinned pages")
    > broke RLIMIT_MEMLOCK.

    I rather like what bc3e53f682 did, actually. RLIMIT_MEMLOCK limits the
    amount of memory you can mlock(). Nice and simple.

    This pinning thing which infiniband/perf are doing is conceptually
    different and if we care at all, perhaps we should be looking at adding
    RLIMIT_PINNED.

    > Before that patch: mm_struct::locked_vm < RLIMIT_MEMLOCK; after that
    > patch we have: mm_struct::locked_vm < RLIMIT_MEMLOCK &&
    > mm_struct::pinned_vm < RLIMIT_MEMLOCK.

    But this is a policy decision which was implemented in perf_mmap() and
    perf can alter that decision. How bad would it be if perf just ignored
    RLIMIT_MEMLOCK?


    drivers/infiniband/hw/qib/qib_user_pages.c has issues, btw. It
    compares the amount-to-be-pinned with rlimit(RLIMIT_MEMLOCK), but
    forgets to also look at current->mm->pinned_vm. Duh.

    It also does the pinned accounting in __qib_get_user_pages() but in
    __qib_release_user_pages(), the caller is supposed to do it, which is
    rather awkward.


    Longer-term I don't think that inifinband or perf should be dinking
    around with rlimit(RLIMIT_MEMLOCK) or ->pinned_vm. Those policy
    decisions should be hoisted into a core mm helper where we can do it
    uniformly (and more correctly than infiniband's attempt!).



    \
     
     \ /
      Last update: 2013-06-13 23:41    [W:3.261 / U:0.032 seconds]
    ©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site