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=-5.8 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI, SPF_HELO_NONE,SPF_PASS autolearn=no 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 41FB0C11F66 for ; Wed, 14 Jul 2021 05:43:07 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 2A4A661370 for ; Wed, 14 Jul 2021 05:43:07 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S237951AbhGNFp5 (ORCPT ); Wed, 14 Jul 2021 01:45:57 -0400 Received: from smtp-out2.suse.de ([195.135.220.29]:48684 "EHLO smtp-out2.suse.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S237903AbhGNFpz (ORCPT ); Wed, 14 Jul 2021 01:45:55 -0400 Received: from relay2.suse.de (relay2.suse.de [149.44.160.134]) by smtp-out2.suse.de (Postfix) with ESMTP id A8A1A2025B; Wed, 14 Jul 2021 05:43:00 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.com; s=susede1; t=1626241380; 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=w0Zh1FaNIeHmI9GVj8h2vOVAdae8z/pZJcGsHZc1oV8=; b=Vm0o20M9JWN9Xa1tHFXAYZoOfGor4yHhrSmk3IT7mvZ0cQsvBaakMH46b2IpiVCbW6dwtI qjpX785zHJZ/xymUSAwNsdx05/G2IMHml0rtJiKM9LW7a+RkzRvJTq9ahbmIcLpu4eOfJB yHHtk7a9u6W8E3s+aWVFQlO7usYinQc= 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 77F9CA3B81; Wed, 14 Jul 2021 05:43:00 +0000 (UTC) Date: Wed, 14 Jul 2021 07:43:00 +0200 From: Michal Hocko To: David Hildenbrand Cc: Evan Green , Andrew Morton , Pavel Machek , Alex Shi , Alistair Popple , Jens Axboe , Johannes Weiner , Joonsoo Kim , "Matthew Wilcox (Oracle)" , Miaohe Lin , Minchan Kim , Vlastimil Babka , linux-kernel@vger.kernel.org, linux-mm@kvack.org, linux-api@vger.kernel.org Subject: Re: [PATCH v2] mm: Enable suspend-only swap spaces Message-ID: References: <20210709105012.v2.1.I09866d90c6de14f21223a03e9e6a31f8a02ecbaf@changeid> <30dddfb1-388c-a593-0987-73e821216da9@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <30dddfb1-388c-a593-0987-73e821216da9@redhat.com> Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Mon 12-07-21 09:41:26, David Hildenbrand wrote: > On 12.07.21 09:03, Michal Hocko wrote: > > [Cc linux-api] > > > > On Fri 09-07-21 10:50:48, Evan Green wrote: > > > Currently it's not possible to enable hibernation without also enabling > > > generic swap for a given swap area. These two use cases are not the > > > same. For example there may be users who want to enable hibernation, > > > but whose drives don't have the write endurance for generic swap > > > activities. > > > > > > Add a new SWAP_FLAG_NOSWAP that adds a swap region but refuses to allow > > > generic swapping to it. This region can still be wired up for use in > > > suspend-to-disk activities, but will never have regular pages swapped to > > > it. > > > > Could you expand some more on why a strict exclusion is really > > necessary? I do understand that one might not want to have swap storage > > available all the time but considering that swapon is really a light > > operation so something like the following should be a reasonable > > workaround, no? > > swapon storage/file > > s2disk > > swapoff storage > > I'm certainly not a hibernation expert, but I'd guess this can also be > triggered by HW events, so from the kernel and not only from user space > where your workaround would apply. Is there anything preventing such a HW event doing the equivalent of the above? -- Michal Hocko SUSE Labs