Received: by 2002:a05:6a11:4021:0:0:0:0 with SMTP id ky33csp2373820pxb; Mon, 20 Sep 2021 20:34:19 -0700 (PDT) X-Google-Smtp-Source: ABdhPJx9PbgVuWzpsGZS1FlKXwfzIQQA5hqWRNes9srk9oSCb1gc9KN9kfghXKDidfGNZvfX8UN2 X-Received: by 2002:a50:d8ce:: with SMTP id y14mr27273809edj.92.1632195259262; Mon, 20 Sep 2021 20:34:19 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1632195259; cv=none; d=google.com; s=arc-20160816; b=wvFmc9+56YQ24BYEVNi6I2bMJqAq6XD6qFQBI1NWg/uwOf+dbaBEO3chneIlFGFsri dh03tfqz68xjLY1wLG/u0kJ/K1U1OMjlMtgNMXD+9qhWBqrUdvacZo4DoOvn1KEHc86O wGiOoo5BpqCTifuSRNyzwE+emkDkZQ3Ta/RvvwU+uXexyONZRGIvYUUDCsRzHPGzsNij FLAzT6mZw1RftroghSmiNC/j/gJGX8JQVT8zbfSKPrtUzTlQI/9aG3ZqxD6sRD3+MpLO iTjGa5na+DP1glggtyNQfNnNq+v85hF11kAmB2Y0617sZjDKGm65r6Gub6ow2E9UkelU zMxQ== 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; bh=0W/o5ZoyGa1oJqJxxVEWjBlKAnqr2zruLqjAEVsS5cI=; b=LbMJpXj00pTcpB4deGAPdkFkoD3G1r/idl8rcauqrtxfykEPgo2Zp8V4BfSV/WjjDL Q0/CYKBvg51hnVwyQWt+qso91KJ+3MKwnijRGYCM9J+QysNK5DxxJIG1lzP3IWrTjT3J dapuEwriFGPlqjNpArsn8LqgO2AeRz0hJCV9t0JJK/lWG+zhJkHa4U+bBVa3wGsheuOp NsZYBCLri+htijFJWFAYhnNnRwloW4FrcQgUw3GnxR09f1e/avd/dxxD6VKy4bk4EVxw K1j2+XYEEANFuurOJW+OyPUBe1LfHPFPKZelwrVz/tYm+x3HUGi0h2hjzCxoEDvxAl73 KgLQ== ARC-Authentication-Results: i=1; mx.google.com; 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 Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id d22si1809337edn.339.2021.09.20.20.33.55; Mon, 20 Sep 2021 20:34:19 -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; 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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231467AbhITTUL (ORCPT + 99 others); Mon, 20 Sep 2021 15:20:11 -0400 Received: from mail-pl1-f181.google.com ([209.85.214.181]:33391 "EHLO mail-pl1-f181.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1347482AbhITTSK (ORCPT ); Mon, 20 Sep 2021 15:18:10 -0400 Received: by mail-pl1-f181.google.com with SMTP id t4so11779146plo.0 for ; Mon, 20 Sep 2021 12:16:43 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:in-reply-to; bh=0W/o5ZoyGa1oJqJxxVEWjBlKAnqr2zruLqjAEVsS5cI=; b=QniF894uWJHaqwIiXCrvpvpQNTs0KM+4AwfMUNKJFBBldF4NJK4cc30PYrTMDQUgdW FLD7qJYajmvPu8oLfCylG4QcEAQqqV51meIs+Ieco3C9N6gfmqtKTVwpDPaCrmh+/gou PKpbysK9qanAmSsoMy1JpAF7gZsW4Rl9x06ZOmU/HvDjIgKbu8WpOeOUYMBet59wiv0R LZfhkcw7wtrY0McG5qWPsUfd7jKrpb0GawzewYwQwjOEHwP47Xd4EbcAV48gM9pMPzmb wD/kRbA4/L8GpWHbjh8C9ETKATo6XFIi1+IaETSj0tgz0NkB9aQqtMGBiddoEYZNQsdx EUWA== X-Gm-Message-State: AOAM533cDGiPuWmu/rYJToN7yEZQY9wDLtjjFQm/k1rp1j6205r+CVmM x8/awrP2wQXQqhkkfqFjPEo= X-Received: by 2002:a17:90b:1291:: with SMTP id fw17mr631393pjb.135.1632165402859; Mon, 20 Sep 2021 12:16:42 -0700 (PDT) Received: from sultan-box.localdomain ([204.152.215.247]) by smtp.gmail.com with ESMTPSA id c9sm123389pfi.212.2021.09.20.12.16.41 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 20 Sep 2021 12:16:42 -0700 (PDT) Date: Mon, 20 Sep 2021 12:16:39 -0700 From: Sultan Alsawaf To: Michal Hocko 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, Sep 20, 2021 at 07:34:26PM +0200, Michal Hocko wrote: > The intention and the scope of the patch should be in the changelog. > Your Fixes tag suggests there is a problem to fixed. I guess References would be more appropriate here? I'm not familiar with every subsystem's way of doing things, so I just rolled with Fixes to leave a breadcrumb trail to the original commit implicated in my change. What would you suggest in a case like this for mm patches? > My memory has faded but I suspect it was to make sure that the oom > reaper is not blocking the system wide freezing. The operation mode of > the thread is to wait for oom victims and then do the unmapping without > any blocking. While it can be frozen during the operation I do not > remember that causing any problems and the waiting is exactly the point > when that is obviously safe - hence wait_event_freezable which I believe > is the proper API to use. This isn't clear to me. Kthreads come with PF_NOFREEZE set by default, so the system-wide freezing will already ignore the reaper thread as-is, although it will make that determination from inside freeze_task() and thus freezing_slow_path(), which involves acquiring a lock. You could set PF_FREEZER_SKIP to skip the slowpath evaluation entirely. Furthermore, the use of wait_event_freezable() will make the reaper thread enter try_to_freeze() every time it's woken up. This seems wasteful considering that the reaper thread will never actually freeze. Sultan