From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751588Ab1I0BDf (ORCPT ); Mon, 26 Sep 2011 21:03:35 -0400 Received: from smtp-out.google.com ([216.239.44.51]:7486 "EHLO smtp-out.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751157Ab1I0BDe (ORCPT ); Mon, 26 Sep 2011 21:03:34 -0400 DomainKey-Signature: a=rsa-sha1; s=beta; d=google.com; c=nofws; q=dns; h=dkim-signature:date:from:x-x-sender:to:cc:subject: in-reply-to:message-id:references:user-agent:mime-version:content-type:x-system-of-record; b=V/5ZMzpjvINU7tDd+6YgLaz64wW3UfABc0cjRmrlaCWdSCAaFLEesGrSWIb5B1n+n ZAsV0dN56Y5J5pJp4oGUA== Date: Mon, 26 Sep 2011 18:03:26 -0700 (PDT) From: David Rientjes X-X-Sender: rientjes@chino.kir.corp.google.com To: "Rafael J. Wysocki" , Michal Hocko cc: Oleg Nesterov , Konstantin Khlebnikov , linux-mm@kvack.org, Andrew Morton , linux-kernel@vger.kernel.org, KOSAKI Motohiro , KAMEZAWA Hiroyuki , Tejun Heo , Rusty Russell Subject: Re: [PATCH 1/2] oom: do not live lock on frozen tasks In-Reply-To: <201109261751.40688.rjw@sisk.pl> Message-ID: References: <20110825151818.GA4003@redhat.com> <20110926091440.GE10156@tiehlicka.suse.cz> <201109261751.40688.rjw@sisk.pl> User-Agent: Alpine 2.00 (DEB 1167 2008-08-23) MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII X-System-Of-Record: true Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Mon, 26 Sep 2011, Rafael J. Wysocki wrote: > > Konstantin Khlebnikov has reported (https://lkml.org/lkml/2011/8/23/45) > > that OOM can end up in a live lock if select_bad_process picks up a frozen > > task. > > Unfortunately we cannot mark such processes as unkillable to ignore them > > because we could panic the system even though there is a chance that > > somebody could thaw the process so we can make a forward process (e.g. a > > process from another cpuset or with a different nodemask). > > > > Let's thaw an OOM selected frozen process right after we've sent fatal > > signal from oom_kill_task. > > Thawing is safe if the frozen task doesn't access any suspended device > > (e.g. by ioctl) on the way out to the userspace where we handle the > > signal and die. Note, we are not interested in the kernel threads because > > they are not oom killable. > > > > Accessing suspended devices by a userspace processes shouldn't be an > > issue because devices are suspended only after userspace is already > > frozen and oom is disabled at that time. > > > > run_guest (drivers/lguest/core.c) calls try_to_freeze with an user > > context but it seems it is able to cope with signals because it > > explicitly checks for pending signals so we should be safe. > > > > Other than that userspace accesses the fridge only from the > > signal handling routines so we are able to handle SIGKILL without any > > negative side effects. > > > > Signed-off-by: Michal Hocko > > Reported-by: Konstantin Khlebnikov > > Acked-by: Rafael J. Wysocki > Acked-by: David Rientjes Although this still seems to be problematic if the chosen thread gets frozen before the SIGKILL can be handled. We don't have any checks for fatal_signal_pending() when freezing threads and waiting for them to exit? Michal, could you send Andrew your revised patch with all the acked-bys? Thanks!