Received: by 2002:a05:6a11:4021:0:0:0:0 with SMTP id ky33csp2500389pxb; Tue, 21 Sep 2021 00:52:30 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzRzsU7RnQNuGg8EAHMUjTAlPdNGppQDkbhP3AEeKAVu6vSoKRZzV4LRjG7wvWYLLz/tDRJ X-Received: by 2002:a50:e1cd:: with SMTP id m13mr539793edl.93.1632210749451; Tue, 21 Sep 2021 00:52:29 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1632210749; cv=none; d=google.com; s=arc-20160816; b=c5iB8Uck9GLV43glt1ti0U26g0hUNjdYEmKfhK9z203ciPTNw7NYtiVMjH3u+itlzH BSmSB7g8e2pEN2NfcYM8pCy453nMX1CkoGPIIXLzvdU2TjtGjSgqxBeb0AlozupOMnCl ATAcgCPIc5V3KUmogpxmk+Nfnl/70xEkUKiVK6aLMknBS7PmDc+l0KaDqzvZ/Ng3On0w 0Hi1yjvHksu+wqej4pb389qqP4MRDs6IKf0ibX17C5YTltAxZx03DXspNRRY6i5p30tX sgVOpFCmcFu4klEM0nDoP94ceKW556Xon0RoeHwuZBJeCNVOWrc9Ah60Yockf3aTUVvT 0s/w== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-disposition:mime-version :references:message-id:subject:cc:to:from:date:dkim-signature; bh=FTiZUwoZLD7CoTiPY7EAa8Ut/2BuzZbrnfa7NhOfH4g=; b=RDVK56s9xST7z78Iqhv+4awrfxB+9Tu8SsU9vasJMEXChnBL7UZeOxqW9qU6vaREFE xgCaqrs6XUIVHhTAv2xIMiA7rxe4UGxivAgyPqCePDKJeNK/ZtBfj26S+0GwOG1Tgho5 vdNjpRq90+Pf0dlHgf78t85Gpc7fhy5fsyj3Pre0+M44/+gruY3lsW0flOQDIzca1xd8 7CaO43IxIg7ZZQVDW8sBvYmGkQ4koU0+x6m+es3ACuTmNi7xfkPtnizRmMZ+pWYjWwV0 IN5eT1zxkaFjRLi4nhoC5bfN6yn6s6ct+AJbO897yGF2tGYO7y1zmDmLw5eaR6KCPO+V sI1g== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@suse.com header.s=susede1 header.b="WaTWtd/z"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=QUARANTINE sp=NONE dis=NONE) header.from=suse.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id i14si18983579eje.121.2021.09.21.00.52.05; Tue, 21 Sep 2021 00:52:29 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@suse.com header.s=susede1 header.b="WaTWtd/z"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=QUARANTINE sp=NONE dis=NONE) header.from=suse.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230172AbhIUHvv (ORCPT + 99 others); Tue, 21 Sep 2021 03:51:51 -0400 Received: from smtp-out1.suse.de ([195.135.220.28]:60946 "EHLO smtp-out1.suse.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230136AbhIUHvs (ORCPT ); Tue, 21 Sep 2021 03:51:48 -0400 Received: from relay2.suse.de (relay2.suse.de [149.44.160.134]) by smtp-out1.suse.de (Postfix) with ESMTP id 9938D21D59; Tue, 21 Sep 2021 07:50:19 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.com; s=susede1; t=1632210619; 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=FTiZUwoZLD7CoTiPY7EAa8Ut/2BuzZbrnfa7NhOfH4g=; b=WaTWtd/zyEaKy32pCO/ZFivMBrGBsNSSYsOmLfz2N2vNrCNSqUdoJXcC5wAJfcHU1tEjFe hLxCmBUc61a4RKr1Zs4/cThVcZfwuJIJ/KE+0hwgql2dctCRltou2hlafJSjc+G8Co/py7 lAsLJeP1KoKdl9BY+Hob9NW/qbqRgbY= 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 4584EA3B9D; Tue, 21 Sep 2021 07:50:19 +0000 (UTC) Date: Tue, 21 Sep 2021 09:50:18 +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: Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Mon 20-09-21 15:29:46, Sultan Alsawaf wrote: > On Mon, Sep 20, 2021 at 10:30:12PM +0200, Michal Hocko wrote: > > We usually tend to provide Fixes where there has been something fixed. > > It seems just confusing if it is used for non functional changes, > > cleanups etc. Thera are gray zones of course. > > Got it, thanks. So no tag would be used in such a case? > > > I am not sure I follow. My understanding is that we need to make sure > > oom_reaper is not running after the quiescent state as it is changing > > user space address space. For that I believe we need to freeze the > > kthread at a proper moment. That is currently the entry point and maybe > > we can extend that even to the reaping loop but I haven't really > > explored that. PF_FREEZER_SKIP would skip over the reaper and that could > > result in it racing with the snapshotting no? > > Kthreads cannot be implicitly frozen; it's not like PREEMPT. From what I've read > in the freezer code, two things must occur for a kthread to freeze: the kthread > must have PF_NOFREEZE unset (via set_freezable(), as is done in the patch I've > submitted here), and the kthread must have an explicit call into the freezer, > such as via wait_event_freezable(). > > Right now, oom_reaper is totally ignored by the freezer because PF_NOFREEZE is > set by default in all kthreads. As such, oom_reaper can keep running while > system-wide freezing occurs. If you think this can mangle snapshots, then > perhaps there is a real bug here after all. OK, now I am getting your point. Sorry for being dense here. Process freezing has always been kinda muddy to me as I've said earlier. I have completely misunderstood your earlier PF_NOFREEZE remark. -- Michal Hocko SUSE Labs