From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S933165AbcFOOsp (ORCPT ); Wed, 15 Jun 2016 10:48:45 -0400 Received: from mx1.redhat.com ([209.132.183.28]:45564 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S933095AbcFOOso (ORCPT ); Wed, 15 Jun 2016 10:48:44 -0400 Date: Wed, 15 Jun 2016 16:48:35 +0200 From: Oleg Nesterov To: Michal Hocko Cc: linux-mm@kvack.org, Tetsuo Handa , David Rientjes , Vladimir Davydov , Andrew Morton , LKML , Michal Hocko Subject: Re: [PATCH 09/10] mm, oom_reaper: do not attempt to reap a task more than twice Message-ID: <20160615144835.GB7944@redhat.com> References: <1465473137-22531-1-git-send-email-mhocko@kernel.org> <1465473137-22531-10-git-send-email-mhocko@kernel.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <1465473137-22531-10-git-send-email-mhocko@kernel.org> User-Agent: Mutt/1.5.24 (2015-08-30) X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.28]); Wed, 15 Jun 2016 14:48:44 +0000 (UTC) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 06/09, Michal Hocko wrote: > > @@ -556,8 +556,27 @@ static void oom_reap_task(struct task_struct *tsk) > schedule_timeout_idle(HZ/10); > > if (attempts > MAX_OOM_REAP_RETRIES) { > + struct task_struct *p; > + > pr_info("oom_reaper: unable to reap pid:%d (%s)\n", > task_pid_nr(tsk), tsk->comm); > + > + /* > + * If we've already tried to reap this task in the past and > + * failed it probably doesn't make much sense to try yet again > + * so hide the mm from the oom killer so that it can move on > + * to another task with a different mm struct. > + */ > + p = find_lock_task_mm(tsk); > + if (p) { > + if (test_and_set_bit(MMF_OOM_NOT_REAPABLE, &p->mm->flags)) { > + pr_info("oom_reaper: giving up pid:%d (%s)\n", > + task_pid_nr(tsk), tsk->comm); > + set_bit(MMF_OOM_REAPED, &p->mm->flags); But why do we need MMF_OOM_NOT_REAPABLE? We set MMF_OOM_REAPED, oom_reap_task() should not see this task again, at least too often. Oleg.