From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-15.7 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER, INCLUDES_PATCH,MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id EC60FC433F5 for ; Tue, 21 Sep 2021 10:48:42 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id 827666112F for ; Tue, 21 Sep 2021 10:48:42 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.1 mail.kernel.org 827666112F Authentication-Results: mail.kernel.org; dmarc=fail (p=quarantine dis=none) header.from=suse.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=kvack.org Received: by kanga.kvack.org (Postfix) id 1B116900003; Tue, 21 Sep 2021 06:48:42 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 161AA900002; Tue, 21 Sep 2021 06:48:42 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 05073900003; Tue, 21 Sep 2021 06:48:42 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0183.hostedemail.com [216.40.44.183]) by kanga.kvack.org (Postfix) with ESMTP id EB2AA900002 for ; Tue, 21 Sep 2021 06:48:41 -0400 (EDT) Received: from smtpin30.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay03.hostedemail.com (Postfix) with ESMTP id B36A38249980 for ; Tue, 21 Sep 2021 10:48:41 +0000 (UTC) X-FDA: 78611257242.30.1401410 Received: from smtp-out1.suse.de (smtp-out1.suse.de [195.135.220.28]) by imf24.hostedemail.com (Postfix) with ESMTP id 48872B0000A4 for ; Tue, 21 Sep 2021 10:48:41 +0000 (UTC) Received: from relay2.suse.de (relay2.suse.de [149.44.160.134]) by smtp-out1.suse.de (Postfix) with ESMTP id 00F9B22107; Tue, 21 Sep 2021 10:48:40 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.com; s=susede1; t=1632221320; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=oTrnXcZ3GhNgBeR9otu2CjH85yvge7Ji7nxVtXw19PQ=; b=iKaC7kwTRfYXGgddBAYmg48b6yu6Z5uetdZn7PHw7PdcbCZyz/Qu/KHmQgn/z3XawPpr4k nnS6T8DlF0uw4KG3co8xgOKOBBes3l3dGHuV8q0KIxd5AaUUtDsdYao0KJBR8tHgVjO6OG XK73OiQb7kdw7sSrJL/xlt1j5e+1FBg= Received: from suse.cz (unknown [10.100.201.86]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by relay2.suse.de (Postfix) with ESMTPS id BFB2EA3BA2; Tue, 21 Sep 2021 10:48:39 +0000 (UTC) Date: Tue, 21 Sep 2021 12:48:39 +0200 From: Michal Hocko To: Sultan Alsawaf Cc: Andrew Morton , David Rientjes , Mel Gorman , linux-mm@kvack.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH] mm: Mark the OOM reaper thread as freezable Message-ID: References: <20210918233920.9174-1-sultan@kerneltoast.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20210918233920.9174-1-sultan@kerneltoast.com> X-Rspamd-Server: rspam01 X-Rspamd-Queue-Id: 48872B0000A4 Authentication-Results: imf24.hostedemail.com; dkim=pass header.d=suse.com header.s=susede1 header.b=iKaC7kwT; dmarc=pass (policy=quarantine) header.from=suse.com; spf=pass (imf24.hostedemail.com: domain of mhocko@suse.com designates 195.135.220.28 as permitted sender) smtp.mailfrom=mhocko@suse.com X-Stat-Signature: fx6shxmh11hn41yaaufziikqisrz84d8 X-HE-Tag: 1632221321-799548 X-Bogosity: Ham, tests=bogofilter, spamicity=0.000000, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: On Sat 18-09-21 16:39:20, Sultan Alsawaf wrote: > From: Sultan Alsawaf > > The OOM reaper thread uses wait_event_freezable() without actually being > marked as freezable. Fix it by adding a set_freezable() call. After the follow up discussion it is clear what the patch does and why it is needed. The changelog really begs for some clarification. I would propose something like " The OOM reaper kthread uses wait_event_freezable while it is waiting for any work. It is safe to freeze it while waiting. We, however, need to prevent any activity after global freezer quiescent state because the oom reaping is altering address space and this might alter the snapshot theoretically (please note that this is mostly a theoretical concern not being observed in practice so far) so the freezer has to wait for an explicit freezing. The current implementation doesn't work that way though because all kernel threads are created with PF_NOFREEZE flag so they are automatically excluded from freezing operation. This means that oom_reaper can race with the system snapshoting if it was processing while the system is being frozen. Fix that by set_freezable which will make the oom_reaper visible to the freezer. " > > Fixes: aac453635549 ("mm, oom: introduce oom reaper") > Signed-off-by: Sultan Alsawaf With the above or otherwise improved changelog feel free to add Acked-by: Michal Hocko Thanks! > --- > mm/oom_kill.c | 2 ++ > 1 file changed, 2 insertions(+) > > diff --git a/mm/oom_kill.c b/mm/oom_kill.c > index 831340e7ad8b..46a742b57735 100644 > --- a/mm/oom_kill.c > +++ b/mm/oom_kill.c > @@ -641,6 +641,8 @@ static void oom_reap_task(struct task_struct *tsk) > > static int oom_reaper(void *unused) > { > + set_freezable(); > + > while (true) { > struct task_struct *tsk = NULL; > > -- > 2.33.0 -- Michal Hocko SUSE Labs