Received: by 2002:a05:6a10:f3d0:0:0:0:0 with SMTP id a16csp948285pxv; Thu, 1 Jul 2021 13:04:10 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzhQ1LQ8jKMfP+Hj40w1C5bN4zfrjsDEHPQJY7ErA4X05a7EksFM95vPLQZE36SFkfs9Cqf X-Received: by 2002:a5e:8907:: with SMTP id k7mr885498ioj.114.1625169850467; Thu, 01 Jul 2021 13:04:10 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1625169850; cv=none; d=google.com; s=arc-20160816; b=L3TbBqXEfJrLfSyv+kNqUMizJLiRlJTKwvkMajk2AiCJRXiSwOfL4ji4o0uOdzv2H/ SYrJRVqjVRRnJQp/hHl7b6I/rbJLNp7EqqEdwndsTYVtDC/ie49kWi1WBBkv03HQXKsY c2ihDLKAeWU59UGpN2zziG5erCW6TIXyaEv3COfxZduGn0fF3Rytd6kZUCihjvTUQslN j4sj4ZGbnGSbMO046Y3+ai3LVXQa3HW44kGuazqI+dGONCpkFnKkHmAmDb9btDC4i1Ro X7/6/wzb+CkQlqHrFnFA2Pjcm1grhLp+B1yJPjnq3uYRlNIOyvZQqQdc9SsmEklTXbTj iNcg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:user-agent:in-reply-to:content-disposition :mime-version:references:message-id:subject:cc:to:from:date; bh=Xn3S0SD2WIN/1z2RaTxNbHtlieX2y/DZRHtz4TKV5qw=; b=0Zig0gHShsCt3+7sL4vsZBVz+xVrt1u/KyojTBu5gRXuayyP27/TmhwdEw4pRrdcse OnF0MEnnWzP+BvYZkOSO9UjAAOdz6nBdM1ztYyi5hRv7RPlT4KDpeUOdxj8k2a1TjMBh VDj8nSSpKSjwYLKbvdODoy4uU7WRaNknfIUg9IiUC78bt92sllzMi8gpHjob0iPuWMBz Drz+IFHgYM0QMvOypWMHsECVSjk1nXaoDp1vOqWaX/BrdVRMeZ3CrE67Xa/0EL1rLi+r BZVVEEaDPiJ/kslGMT0Ojw+V9avWjo5dnG9Iq9SmpmJ12+28olsBKzKCwvPfHtmty1S8 Ju8A== 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 e13si865054ioe.10.2021.07.01.13.03.55; Thu, 01 Jul 2021 13:04:10 -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 S233738AbhGAUF0 (ORCPT + 99 others); Thu, 1 Jul 2021 16:05:26 -0400 Received: from jabberwock.ucw.cz ([46.255.230.98]:46278 "EHLO jabberwock.ucw.cz" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230088AbhGAUF0 (ORCPT ); Thu, 1 Jul 2021 16:05:26 -0400 Received: by jabberwock.ucw.cz (Postfix, from userid 1017) id B26511C0B7F; Thu, 1 Jul 2021 22:02:54 +0200 (CEST) Date: Thu, 1 Jul 2021 22:02:53 +0200 From: Pavel Machek To: Evan Green Cc: Andrew Morton , Alex Shi , Alistair Popple , David Hildenbrand , Jens Axboe , Johannes Weiner , Joonsoo Kim , "Matthew Wilcox (Oracle)" , Miaohe Lin , Minchan Kim , Stephen Rothwell , Vlastimil Babka , linux-kernel@vger.kernel.org, linux-mm@kvack.org Subject: Re: [PATCH v1] mm: Enable suspend-only swap spaces Message-ID: <20210701200253.GB983@bug> References: <20210630100432.v1.1.I09866d90c6de14f21223a03e9e6a31f8a02ecbaf@changeid> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20210630100432.v1.1.I09866d90c6de14f21223a03e9e6a31f8a02ecbaf@changeid> User-Agent: Mutt/1.5.23 (2014-03-12) Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Hi! > 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. > > Signed-off-by: Evan Green Makes sense to me. Reviewed-by: Pavel Machek > #define SWAP_FLAG_DISCARD_ONCE 0x20000 /* discard swap area at swapon-time */ > #define SWAP_FLAG_DISCARD_PAGES 0x40000 /* discard page-clusters after use */ > +#define SWAP_FLAG_NOSWAP 0x80000 /* use only for suspend, not swap */ I'd say "only for hibernation". And actually maybe code would be more clear if logic was reverted. Aha, and you may want to check... does the hibernation still work for you without the swap? Because we need half memory free to create swap image and swap is really quite useful for that. Best regards, Pavel -- (english) http://www.livejournal.com/~pavelmachek (cesky, pictures) http://atrey.karlin.mff.cuni.cz/~pavel/picture/horses/blog.html