From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1756790AbcEaVs2 (ORCPT ); Tue, 31 May 2016 17:48:28 -0400 Received: from mx1.redhat.com ([209.132.183.28]:54767 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1756718AbcEaVs0 (ORCPT ); Tue, 31 May 2016 17:48:26 -0400 Date: Tue, 31 May 2016 23:48:23 +0200 From: Oleg Nesterov To: Michal Hocko Cc: linux-mm@kvack.org, Tetsuo Handa , David Rientjes , Vladimir Davydov , Andrew Morton , LKML Subject: Re: [PATCH 5/6] mm, oom: kill all tasks sharing the mm Message-ID: <20160531214823.GC26582@redhat.com> References: <1464613556-16708-1-git-send-email-mhocko@kernel.org> <1464613556-16708-6-git-send-email-mhocko@kernel.org> <20160530181816.GA25480@redhat.com> <20160531074318.GD26128@dhcp22.suse.cz> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20160531074318.GD26128@dhcp22.suse.cz> 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.27]); Tue, 31 May 2016 21:48:26 +0000 (UTC) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 05/31, Michal Hocko wrote: > > On Mon 30-05-16 20:18:16, Oleg Nesterov wrote: > > > > perhaps the is_global_init() == T case needs a warning too? the previous changes > > take care about vfork() from /sbin/init, so the only reason we can see it true > > is that /sbin/init shares the memory with a memory hog... Nevermind, forget. > > I have another two patches waiting for this to settle and one of them > adds a warning to that path. Good, > > This is a bit off-topic, but perhaps we can also change the PF_KTHREAD check later. > > Of course we should not try to kill this kthread, but can_oom_reap can be true in > > this case. A kernel thread which does use_mm() should handle the errors correctly > > if (say) get_user() fails because we unmap the memory. > > I was worried that the kernel thread would see a zero page so this could > lead to a data corruption. We can't avoid this anyway. use_mm(victim->mm) can be called after we decide to kill the victim. So I think that we should always ignore kthreads, and in task_will_free_mem() too. But let me repeat, I agree we should discuss this later, I am not trying to suggest this change right now. Oleg.