Received: by 2002:ad5:474a:0:0:0:0:0 with SMTP id i10csp6502378imu; Wed, 14 Nov 2018 02:31:06 -0800 (PST) X-Google-Smtp-Source: AJdET5cyEWS0aNGwL5yRRyfQwK4PCgm6X0zhaFcvHBWlA4wZX2WYw/Bi7YAowbCQn5m2zyPrSXl1 X-Received: by 2002:a62:9642:: with SMTP id c63-v6mr1436716pfe.100.1542191466463; Wed, 14 Nov 2018 02:31:06 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1542191466; cv=none; d=google.com; s=arc-20160816; b=S97C2ce+Php9+ZGSJ5sJmUycT4qdXXfLiy+GmoCuelOexMv348QnbeUWXShG8M/Bon Ab4tRY7DcOyyhbgxknW6kn+r8z7gJLdFiBSyJma7bkAdIwAPwZCrpZz3mH2wy3UDmxGk excKslpo3aGhauNgt7aptSo1VYSZn6k8FIW9ePoMdsZMAMaSoDH8n0EfeOC7OrJPIsl6 TxJHYs72XqYWwfWJ0A6NFdVdQPUeGZMWCCVa5ykfwHHKxO36ut+uiAsE7E1wW3wSgDtQ vc1IeDiQFprkc0DtKZuICFgbSN9f6EPq6jyxwqaq2xvgTa1UWahoGKyXRdxmGm8B9Ave AOkQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:in-reply-to :content-disposition:mime-version:references:message-id:subject:cc :to:from:date; bh=H1CTqZtErG7ufZVCox6rIxir6ZzLH6/aLvLRNand+bA=; b=ixsdR8baz6pRqAwQqpp1+R1vWOyqaO5Dcc9zA1d1ND1VCP9MRF/1vjq1Q6vSQ8t5Wa 1jtKkZw7dpMhUzWde6je+PjkoZ7IrBjcA1/H3AEpdlu75j98HrNn8bL1mOfVPbtl5QjK NbIVEFqB64qhYNX5dYSSxyCFPHqeu5fNXg+ATkZGy/OdEv5Gvf6NiQwTdJF4pIafbWbu NC3zTXaxl+RT2lOCNvlEnmHX7ZUznAYGnmZXf7mpOBdwL6ggwgVjB2l97CLUOn1M6W1A atIDaCiy39KjtOxB+opSBlIQUIlSInCWwvURpPFglOJs83Oq/co50FNzBuW6VeJRaYFU IZiw== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id v123-v6si25174184pfb.65.2018.11.14.02.30.44; Wed, 14 Nov 2018 02:31:06 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1732651AbeKNUdC (ORCPT + 99 others); Wed, 14 Nov 2018 15:33:02 -0500 Received: from mx2.suse.de ([195.135.220.15]:45756 "EHLO mx1.suse.de" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1726823AbeKNUdC (ORCPT ); Wed, 14 Nov 2018 15:33:02 -0500 X-Virus-Scanned: by amavisd-new at test-mx.suse.de Received: from relay2.suse.de (unknown [195.135.220.254]) by mx1.suse.de (Postfix) with ESMTP id 73514AFE4; Wed, 14 Nov 2018 10:30:20 +0000 (UTC) Date: Wed, 14 Nov 2018 11:30:14 +0100 From: Michal Hocko To: Chanho Min Cc: 'Oleg Nesterov' , "'Rafael J. Wysocki'" , 'Pavel Machek' , 'Len Brown' , 'Andrew Morton' , "'Eric W. Biederman'" , 'Christian Brauner' , 'Anna-Maria Gleixner' , 'Alexander Viro' , linux-pm@vger.kernel.org, linux-kernel@vger.kernel.org, linux-fsdevel@vger.kernel.org, 'Seungho Park' , 'Inkyu Hwang' , 'Donghwan Jung' , 'Jongsung Kim' Subject: Re: [PATCH v2] exec: make de_thread() freezable Message-ID: <20181114103014.GN23419@dhcp22.suse.cz> References: <1541994885-20059-1-git-send-email-chanho.min@lge.com> <20181113145339.GD16182@dhcp22.suse.cz> <20181113161858.GE30990@redhat.com> <20181113180058.GT15120@dhcp22.suse.cz> <014a01d47c03$6b64eef0$422eccd0$@lge.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <014a01d47c03$6b64eef0$422eccd0$@lge.com> User-Agent: Mutt/1.10.1 (2018-07-13) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Wed 14-11-18 19:18:42, Chanho Min wrote: > > > > It's been some time since I have looked into this code so bear with > me. > > > > One thing is not really clear to me. Why does it help to exclude this > > > > particular task from the freezer > > > > > > we don't exclude it, > > > > > > > when it is not sleeping in the freezer. > > > > > > Yes, it is not sleeping in __refrigerator(), but it does > > > > > > schedule(); > > > freezer_count(); > > > > > > so it will enter __refrigerator() right after wakeup. If it won't be > > woken > > > up we do not care, we can consider it "frozen". > > > > Right, but this is just silencing the freezing code to exclude this > > task, right? > > > > > > I can see how other threads need to be zapped and TASK_WAKEKILL > > doesn't > > > > do that but shouldn't we fix that instead? > > > > > > Not sure I understand, but unlikely we can (or want) to make > > __refrigerator() > > > killable. > > > > Why would that be a problem. If the kill is fatal then why to keep the > > killed task in the fridge? > > > > Is it different between 'the killed task is frozen' and '__refrigerator() > is killable'? > From a general '__refrigerator()' implementation point of view I know that > it should not be killable. Is that because there are many paths that do not terminate right after the task get out of the fridge? Like the signal path? > > > Otherwise, how can we fix that? > > > > We can mark all threads PF_NOFREEZE and wake them up. This would require > > some more changes of course but wouldn't that be a more appropriate > > solution? Do we want to block exec for ever just because some threads > > are in the fridge? > > > > IMHO, It seems to be difficult and buggy to control with PF_NOFREEZE. > Because, > The sub-thread can freeze and receive SIG_KILL before the marking of > PF_NOFREEZE > and it should be freezable in other cases. But we do control the ordering in this path no? > I don't understand why it isn't appropriate for exec to block. The > exec can freeze. When tasks are thawed, the killed sub-thread will die > and wake de_thread(). The exec will continue to work from resume. Because this is fragile. I haven't checked the full set of resources the task holds when in this path but I can imagine we can introduce lock dependency on freezing really easily. -- Michal Hocko SUSE Labs