[Devel] [PATCH RHEL9 COMMIT] oom: Cast the lockdep spell in the code

Konstantin Khorenko khorenko at virtuozzo.com
Mon Nov 28 20:25:14 MSK 2022


The commit is pushed to "branch-rh9-5.14.0-70.22.1.vz9.17.x-ovz" and will appear at https://src.openvz.org/scm/ovz/vzkernel.git
after rh9-5.14.0-70.22.1.vz9.17.11
------>
commit 0b9d9d056113db1de9529d3185c2f0b2fba46e1e
Author: Konstantin Khorenko <khorenko at virtuozzo.com>
Date:   Mon Nov 28 20:13:14 2022 +0300

    oom: Cast the lockdep spell in the code
    
    task_will_free_mem() requires the task_lock lock is held or the function
    is called on the current, but this is just a function comment,
    let's add the proper lockdep check according to this comment.
    
    https://jira.sw.ru/browse/PSBM-143283
    
    Signed-off-by: Konstantin Khorenko <khorenko at virtuozzo.com>
    Suggested-by: Nikolay Borisov <nikolay.borisov at virtuozzo.com>
---
 mm/oom_kill.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/mm/oom_kill.c b/mm/oom_kill.c
index e2b57f595418..ebf158ef5cdb 100644
--- a/mm/oom_kill.c
+++ b/mm/oom_kill.c
@@ -829,6 +829,8 @@ static bool task_will_free_mem(struct task_struct *task)
 	struct task_struct *p;
 	bool ret = true;
 
+	lockdep_assert(lockdep_is_held(&task->alloc_lock) || task == current);
+
 	/*
 	 * Skip tasks without mm because it might have passed its exit_mm and
 	 * exit_oom_victim. oom_reaper could have rescued that but do not rely


More information about the Devel mailing list