Received: by 2002:a05:6520:4d:b0:139:a872:a4c9 with SMTP id i13csp2567343lkm; Mon, 20 Sep 2021 18:54:56 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxlZlMz0DkZmmzJ4WeLJe2ezRwwWdkETkaTuFHfuUcTE17lypWAEfusGDkwg2fKCDQwhtdp X-Received: by 2002:a02:b113:: with SMTP id r19mr14862206jah.133.1632188924562; Mon, 20 Sep 2021 18:48:44 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1632188924; cv=none; d=google.com; s=arc-20160816; b=tOTZS9vDHkJw5GIqtI75WDDwa6s4MXn8PeLm1hSY33ubl3nhGcIpiy/wm8A9r1+XK8 GJp6jEry+c4R5zB/RyzhQdxw9BxrtpcImpN0eSm/DJSszdPWqKHBlSu2SVuIS8VETGdc Bhk4vfmwgEIk69YoLxeB849J8EqiGuafgFeFniU4Fhng6i2KOmai9bQE55iYFT2vENDJ uTlG0zLVzy8MCeYa/BNAwQQrspSMLzbf5A3ymkxhaHsQ/IdW1S/xhdhyTPDhQSOe7ygw DyNqYKQMl/A5TURsOSxBcQWIU7kl596LB7HWvWAWBkLxVRQI7PTQExA95DjIwp2iyZK/ aRvQ== 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=fcviXv9Vg3lihYydgrTXaFZRd5Ie7N10yUs37zQE7Eg=; b=GydSGwd7xLMz8kz5+pboD+wOPj902Aq69/BG88isgmCW3pqm9tMWn0pRTC2nPI3vmF tsKZ71j6SWMd5AJFLEMVc+Z4C2/YBhf29fyY5hyhAZW3NSRfiwbs2jXNlZ1arjwaISWw D81YgxL+QUuabj5HkBzx3S82i1sHinJ9hxFid1twl/lFN5aFwoAVyNZx54ZF7P+6Wnw8 VIpuPkbat3cHKmdWZI5hegyiWaBowoIjsh6E0inElGiET8asgOcIottvH6C/ao3i+lYI ELP1xKSmLgcVF4pV3bXVSwbACdYxzH0ajeE3D+bRfxGy3ZMyNvaj9jYWVsAWv32hQrbW +AYA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@suse.com header.s=susede1 header.b=pLlaFHHB; 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 i12si14404257jac.26.2021.09.20.18.48.33; Mon, 20 Sep 2021 18:48:44 -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=pLlaFHHB; 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 S1348274AbhITRiK (ORCPT + 99 others); Mon, 20 Sep 2021 13:38:10 -0400 Received: from smtp-out2.suse.de ([195.135.220.29]:55442 "EHLO smtp-out2.suse.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1351892AbhITRgD (ORCPT ); Mon, 20 Sep 2021 13:36:03 -0400 Received: from relay2.suse.de (relay2.suse.de [149.44.160.134]) by smtp-out2.suse.de (Postfix) with ESMTP id 7FB6D1FD59; Mon, 20 Sep 2021 17:34:30 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.com; s=susede1; t=1632159270; 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=fcviXv9Vg3lihYydgrTXaFZRd5Ie7N10yUs37zQE7Eg=; b=pLlaFHHB0xQ535CYbSGyPaRvnEGObFKDhtxRtgwiUNj74sY8IG00qnyqAQs2JpWle6hytg cT+yWqJ4F1VaSel2sfWyjgJJa3B6X4Nd25ecGPly/D+YQ95m6fpJerAAfAl9xweMSNlNg6 C+EeTpOYjFSaT4sMPKvc6V68WLgvi+A= 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 4A70BA3E08; Mon, 20 Sep 2021 17:34:30 +0000 (UTC) Date: Mon, 20 Sep 2021 19:34:26 +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 08:55:15, Sultan Alsawaf wrote: > On Mon, Sep 20, 2021 at 02:40:37PM +0200, Michal Hocko wrote: > > What is the actual problem you are trying to solve here. > > There isn't any specific problem I'm trying to solve here; simply that, it > appeared as though you intended for the reaper thread to be freezable when it > actually isn't. The OOM killer is disabled after processes are frozen though so > I guess it could be considered a matter of consistency to freeze the reaper > thread too. The intention and the scope of the patch should be in the changelog. Your Fixes tag suggests there is a problem to fixed. > Do you remember why you used wait_event_freezable()? 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. > > Freezer details are hairy and I have to re-learn them each time again and > > again but from what I remember wait_event_freezable doesn't really depend on > > tyask being freezable. It tells the freezer that the task is OK to exclude > > while it is sleeping and that should be just the case for the oom reaper. Or > > am I missing something? > > The task indeed doesn't need to be freezable, but the rest of what you remember > isn't quite true. It tells the freezer to exclude the task only because the task > will handle entering the freezer on its own. When a task sleeps on > wait_event_freezable(), it will be woken up when system-wide freezing starts, > and then it will try to freeze itself (see freezable_schedule() and > freezer_count()). Thanks for the clarification. > If the freezer bits here are undesired then I think wait_event_interruptible() > should be used instead. I am not saying it is undesired. The crux is to be clear in the reasoning. -- Michal Hocko SUSE Labs