mmap locking API: convert mmap_sem comments
[sfrench/cifs-2.6.git] / mm / oom_kill.c
index 4daedf7b91f67b728f21e1c541d0dc7dc68a1dba..b4e9491cb320e13347e97bf9732bae5dbcb3737b 100644 (file)
@@ -569,7 +569,7 @@ static bool oom_reap_task_mm(struct task_struct *tsk, struct mm_struct *mm)
 {
        bool ret = true;
 
-       if (!down_read_trylock(&mm->mmap_sem)) {
+       if (!mmap_read_trylock(mm)) {
                trace_skip_task_reaping(tsk->pid);
                return false;
        }
@@ -577,8 +577,8 @@ static bool oom_reap_task_mm(struct task_struct *tsk, struct mm_struct *mm)
        /*
         * MMF_OOM_SKIP is set by exit_mmap when the OOM reaper can't
         * work on the mm anymore. The check for MMF_OOM_SKIP must run
-        * under mmap_sem for reading because it serializes against the
-        * down_write();up_write() cycle in exit_mmap().
+        * under mmap_lock for reading because it serializes against the
+        * mmap_write_lock();mmap_write_unlock() cycle in exit_mmap().
         */
        if (test_bit(MMF_OOM_SKIP, &mm->flags)) {
                trace_skip_task_reaping(tsk->pid);
@@ -600,7 +600,7 @@ static bool oom_reap_task_mm(struct task_struct *tsk, struct mm_struct *mm)
 out_finish:
        trace_finish_task_reaping(tsk->pid);
 out_unlock:
-       up_read(&mm->mmap_sem);
+       mmap_read_unlock(mm);
 
        return ret;
 }
@@ -611,7 +611,7 @@ static void oom_reap_task(struct task_struct *tsk)
        int attempts = 0;
        struct mm_struct *mm = tsk->signal->oom_mm;
 
-       /* Retry the down_read_trylock(mmap_sem) a few times */
+       /* Retry the mmap_read_trylock(mm) a few times */
        while (attempts++ < MAX_OOM_REAP_RETRIES && !oom_reap_task_mm(tsk, mm))
                schedule_timeout_idle(HZ/10);
 
@@ -629,7 +629,7 @@ done:
 
        /*
         * Hide this mm from OOM killer because it has been either reaped or
-        * somebody can't call up_write(mmap_sem).
+        * somebody can't call mmap_write_unlock(mm).
         */
        set_bit(MMF_OOM_SKIP, &mm->flags);
 
@@ -898,7 +898,7 @@ static void __oom_kill_process(struct task_struct *victim, const char *message)
        /*
         * Kill all user processes sharing victim->mm in other thread groups, if
         * any.  They don't get access to memory reserves, though, to avoid
-        * depletion of all memory.  This prevents mm->mmap_sem livelock when an
+        * depletion of all memory.  This prevents mm->mmap_lock livelock when an
         * oom killed thread cannot exit because it requires the semaphore and
         * its contended by another thread trying to allocate memory itself.
         * That thread will now get access to memory reserves since it has a