Received: by 2002:a05:6a10:f3d0:0:0:0:0 with SMTP id a16csp1061805pxv; Fri, 9 Jul 2021 16:37:26 -0700 (PDT) X-Google-Smtp-Source: ABdhPJx1cILsfj2vXXfMRinPHFmmzRA1v6bGLP9xwrQ6FwXlqLdoEkPSbWs1MXD1tVicRBID12yC X-Received: by 2002:a05:6402:40c3:: with SMTP id z3mr48044268edb.375.1625873846684; Fri, 09 Jul 2021 16:37:26 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1625873846; cv=none; d=google.com; s=arc-20160816; b=eNpyPkp13ZJ56Hh7CWXP2oFg/7d1y+BAW2/rm960qw6oIRtA+m37uwYuJiNjlkSMlR snwJn6mvknTN2A+vOj56Hl/tELXtFi/RPYlT7TazVH/BzxniWl2MaqYvt/T7dS4QzMFA srGndadBxs2NFVhjKqw2eohlDVe9ksXJ9EUoVrfRultbg5n6CWvVfgbAJx+bQxyX0H7n FYonJFdtWAxxMsHYtbqp9bbNz9nIGt/2I3XTOVg65AIgpE7LEpfhZcDYHm/imE6wknXR 7mSs1kaTyJtFPVgg/bC7d8ogYvNA5WKg+oBafNqCZnwsaOmKlJLt8BjzGf5Jri/V7lv5 w5DA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:subject:cc:to:from:date :dkim-signature; bh=uhPahxGI7ctQ1jFOoZdoAWdgcbqgvnpnA/L85bxJLZw=; b=NRiJTAmP3vtPO676AV1xNz7khXIRDZvx7URr9VVHKrpHl7BIjNtFA4T/owxMH3pPx7 9A2MgUnsAd2ywz8V0KfcunHobi7ABZu5qFCbeoyxmdTcsA4baipR3wPsH/l2Kb5vhem+ u1l6Jkcug+VGLeD5cQ1hoqMzcKqE2rEJA3YWah7S1abpxh8oByXc+J2ost03svqlQlJS NVR16njWFJoI9SBBqhYzyJXhAAx42phXEUfl/fIO8vvD1T/k13HdWLqpZl+m0vaNjcY2 L+ZYIRj2brVTtPr2FbyNoKVPCftomSlIdC6jRSm53tjOv8/FVwTF6j15Fzixn/bIBWtg 4ArA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linux-foundation.org header.s=korg header.b=DPTfJNOq; 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 y21si8851090edc.4.2021.07.09.16.36.50; Fri, 09 Jul 2021 16:37:26 -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=@linux-foundation.org header.s=korg header.b=DPTfJNOq; 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 S230082AbhGIXgO (ORCPT + 99 others); Fri, 9 Jul 2021 19:36:14 -0400 Received: from mail.kernel.org ([198.145.29.99]:59336 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229854AbhGIXgO (ORCPT ); Fri, 9 Jul 2021 19:36:14 -0400 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 Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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.