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=-6.0 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI, NICE_REPLY_A,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 A455CC07E99 for ; Fri, 9 Jul 2021 23:33:32 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id 3B4CA613C2 for ; Fri, 9 Jul 2021 23:33:32 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 3B4CA613C2 Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=linux-foundation.org Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=owner-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix) id 10E236B0073; Fri, 9 Jul 2021 19:33:32 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 0BF406B0078; Fri, 9 Jul 2021 19:33:32 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id EA0A58D0001; Fri, 9 Jul 2021 19:33:31 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0206.hostedemail.com [216.40.44.206]) by kanga.kvack.org (Postfix) with ESMTP id BF9F86B0073 for ; Fri, 9 Jul 2021 19:33:31 -0400 (EDT) Received: from smtpin36.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay03.hostedemail.com (Postfix) with ESMTP id EA28D824C42F for ; Fri, 9 Jul 2021 23:33:30 +0000 (UTC) X-FDA: 78344653380.36.12BDA6C Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by imf08.hostedemail.com (Postfix) with ESMTP id 9048A3000098 for ; Fri, 9 Jul 2021 23:33:30 +0000 (UTC) Received: by mail.kernel.org (Postfix) with ESMTPSA id 3AC18613B2; Fri, 9 Jul 2021 23:33:29 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linux-foundation.org; s=korg; t=1625873609; bh=c3dBoyMfVBLCJti6dHJj/Ms1ixBcQtOC4N6iCNXj6Ss=; h=Date:From:To:Cc:Subject:In-Reply-To:References:From; b=DPTfJNOq1dKrT5NcrotV4jMhMD8ekZARI+Uh/AEUDBQSlYo7z7zYuApVcayEfKScW DFBrscT19kQiP9vkqLALUFmlNwV+r7b186+8Rx27WyYjfLPmkbo1n5oxSQFLJHLM+a CIWSQec7RLqtndk9i4MFG35ke7i/Am6Vvd7fByLg= Date: Fri, 9 Jul 2021 16:33:28 -0700 From: Andrew Morton To: Evan Green Cc: David Hildenbrand , Pavel Machek , Alex Shi , Alistair Popple , Jens Axboe , Johannes Weiner , Joonsoo Kim , "Matthew Wilcox (Oracle)" , Miaohe Lin , Michal Hocko , Minchan Kim , Vlastimil Babka , LKML , linux-mm@kvack.org Subject: Re: [PATCH v2] mm: Enable suspend-only swap spaces Message-Id: <20210709163328.16fcdd3601d1ba0b93baad65@linux-foundation.org> In-Reply-To: References: <20210709105012.v2.1.I09866d90c6de14f21223a03e9e6a31f8a02ecbaf@changeid> <20210709152024.36f650dfec4c66ef3a60a845@linux-foundation.org> X-Mailer: Sylpheed 3.5.1 (GTK+ 2.24.32; x86_64-pc-linux-gnu) Mime-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit Authentication-Results: imf08.hostedemail.com; dkim=pass header.d=linux-foundation.org header.s=korg header.b=DPTfJNOq; spf=pass (imf08.hostedemail.com: domain of akpm@linux-foundation.org designates 198.145.29.99 as permitted sender) smtp.mailfrom=akpm@linux-foundation.org; dmarc=none X-Rspamd-Server: rspam02 X-Stat-Signature: cwmtydtokfh4e6kkhai4qhptj8xerfr6 X-Rspamd-Queue-Id: 9048A3000098 X-HE-Tag: 1625873610-164317 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 Fri, 9 Jul 2021 16:23:18 -0700 Evan Green wrote: > On Fri, Jul 9, 2021 at 3:20 PM Andrew Morton wrote: > > > > On Fri, 9 Jul 2021 10:50:48 -0700 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. > > > > > > Swap regions with SWAP_FLAG_NOSWAP set will not appear in /proc/meminfo > > > under SwapTotal and SwapFree, since they are not usable as general swap. > > > > > > > This patch doesn't appear to set SWAP_FLAG_NOSWAP anywhere. Perhaps > > there's another patch somewhere which changes the hibernation code? If > > so, can we please have both patches in a series? > > There's no other patch, in the kernel at least. SWAP_FLAG_* is exposed > to usermode, which would set it when calling swapon(2). Once this > patch is accepted, I'll have to add the option into util-linux [1], so > that I can use it in my init scripts. > > Said a different way, this patch isn't about altering how hibernate > behaves, but about giving usermode the freedom to set up hibernate and > swap independently. OK, can we please get this into the changelog? And it would be helpful to describe how this will be invoked via swapon(8). And I expect an update to the swapon syscall's manpage will be in order.