Re: [PATCH 7/6] mm, oom: task_will_free_mem should skip oom_reaped tasks

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Michal Hocko wrote:
> diff --git a/mm/oom_kill.c b/mm/oom_kill.c
> index dacfb6ab7b04..d6e121decb1a 100644
> --- a/mm/oom_kill.c
> +++ b/mm/oom_kill.c
> @@ -766,6 +766,15 @@ bool task_will_free_mem(struct task_struct *task)
>  		return true;
>  	}
>  
> +	/*
> +	 * This task has already been drained by the oom reaper so there are
> +	 * only small chances it will free some more
> +	 */
> +	if (test_bit(MMF_OOM_REAPED, &mm->flags)) {
> +		task_unlock(p);
> +		return false;
> +	}
> +

I think this check should be done before

	if (atomic_read(&mm->mm_users) <= 1) {
		task_unlock(p);
		return true;
	}

because it is possible that task_will_free_mem(task) is the only thread
using task->mm (i.e. atomic_read(&mm->mm_users) == 1).

>  	/* pin the mm to not get freed and reused */
>  	atomic_inc(&mm->mm_count);
>  	task_unlock(p);
> -- 
> 2.8.1

--
To unsubscribe, send a message with 'unsubscribe linux-mm' in
the body to majordomo@xxxxxxxxx.  For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"dont@xxxxxxxxx";> email@xxxxxxxxx </a>



[Index of Archives]     [Linux ARM Kernel]     [Linux ARM]     [Linux Omap]     [Fedora ARM]     [IETF Annouce]     [Bugtraq]     [Linux]     [Linux OMAP]     [Linux MIPS]     [ECOS]     [Asterisk Internet PBX]     [Linux API]