Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754791Ab0FPPCl (ORCPT ); Wed, 16 Jun 2010 11:02:41 -0400 Received: from mail-pv0-f174.google.com ([74.125.83.174]:54758 "EHLO mail-pv0-f174.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1755114Ab0FPPCi (ORCPT ); Wed, 16 Jun 2010 11:02:38 -0400 DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=date:from:to:cc:subject:message-id:references:mime-version :content-type:content-disposition:in-reply-to:user-agent; b=WG4eXL2UzQ7v1HJd4LciDhgoytijsCYUTTSMLN1gzKHxp7Bf+euDR/vsawwhQviNmr y283vuDbcrL3uhMGqugHAoJLGxWCHjhMVdogH6oqC80O5uZ5IZiJrgpVgnoOtWdAd/XW zTFsgpXk7M97eS/l41kMbpfUZJRTfdthoxPC4= Date: Thu, 17 Jun 2010 00:02:32 +0900 From: Minchan Kim To: KOSAKI Motohiro Cc: LKML , linux-mm , Andrew Morton , David Rientjes , KAMEZAWA Hiroyuki Subject: Re: [PATCH 3/9] oom: oom_kill_process() doesn't select kthread child Message-ID: <20100616150232.GC9278@barrios-desktop> References: <20100616201948.72D7.A69D9226@jp.fujitsu.com> <20100616203126.72DD.A69D9226@jp.fujitsu.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20100616203126.72DD.A69D9226@jp.fujitsu.com> User-Agent: Mutt/1.5.20 (2009-06-14) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 1155 Lines: 30 On Wed, Jun 16, 2010 at 08:32:08PM +0900, KOSAKI Motohiro wrote: > Now, select_bad_process() have PF_KTHREAD check, but oom_kill_process > doesn't. It mean oom_kill_process() may choose wrong task, especially, > when the child are using use_mm(). Now oom_kill_process is called by three place. 1. mem_cgroup_out_of_memory 2. out_of_memory with sysctl_oom_kill_allocating_task 3. out_of_memory with non-sysctl_oom_kill_allocating_task I think it's no problem in 1 and 3 since select_bad_process already checks PF_KTHREAD. The problem in in 2. So How about put the check before calling oom_kill_process in case of sysctl_oom_kill_allocating task? if (sysctl_oom_kill_allocating_task) { if (!current->flags & PF_KTHREAD) oom_kill_process(); It can remove duplicated PF_KTHREAD check in select_bad_process and oom_kill_process. -- Kind regards, Minchan Kim -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/