From patchwork Mon Jun 1 16:06:34 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andrea Righi X-Patchwork-Id: 11582357 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 26E6214F6 for ; Mon, 1 Jun 2020 16:06:52 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id F20CF206C3 for ; Mon, 1 Jun 2020 16:06:51 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org F20CF206C3 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=canonical.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=owner-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix) id 6F5C88E0006; Mon, 1 Jun 2020 12:06:49 -0400 (EDT) Delivered-To: linux-mm-outgoing@kvack.org Received: by kanga.kvack.org (Postfix, from userid 40) id 6A6AD80008; Mon, 1 Jun 2020 12:06:49 -0400 (EDT) X-Original-To: int-list-linux-mm@kvack.org X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 5BA3E8E0007; Mon, 1 Jun 2020 12:06:49 -0400 (EDT) X-Original-To: linux-mm@kvack.org X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0085.hostedemail.com [216.40.44.85]) by kanga.kvack.org (Postfix) with ESMTP id 465488E0006 for ; Mon, 1 Jun 2020 12:06:49 -0400 (EDT) Received: from smtpin28.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay01.hostedemail.com (Postfix) with ESMTP id 000C0180AD807 for ; Mon, 1 Jun 2020 16:06:48 +0000 (UTC) X-FDA: 76881121338.28.tent66_58450f1df0d2c Received: from filter.hostedemail.com (10.5.16.251.rfc1918.com [10.5.16.251]) by smtpin28.hostedemail.com (Postfix) with ESMTP id 1E835141F2 for ; Mon, 1 Jun 2020 16:06:47 +0000 (UTC) X-Spam-Summary: 30,2,0,4bd8b34191919256,d41d8cd98f00b204,andrea.righi@canonical.com,,RULES_HIT:41:69:355:379:541:967:973:988:989:1260:1311:1314:1345:1437:1515:1534:1541:1711:1730:1747:1777:1792:1801:2393:2525:2559:2564:2682:2685:2859:2933:2937:2939:2942:2945:2947:2951:2954:3000:3022:3138:3139:3140:3141:3142:3352:3865:3866:3867:3868:3870:3871:3874:3934:3936:3938:3941:3944:3947:3950:3953:3956:3959:4362:4470:4605:5007:6117:6119:6120:6261:7974:8603:8957:9025:10010:11026:11658:11914:12043:12219:12291:12297:12517:12519:12555:12679:12683:13069:13161:13169:13229:13311:13357:13894:14181:14384:14581:14721:21060:21080:21325:21444:21451:21627:21740:21795:30054:30056:30064:30074,0,RBL:91.189.89.112:@canonical.com:.lbl8.mailshell.net-64.201.201.201 62.8.15.100,CacheIP:none,Bayesian:0.5,0.5,0.5,Netcheck:none,DomainCache:0,MSF:not bulk,SPF:fn,MSBL:0,DNSBL:neutral,Custom_rules:0:1:0,LFtime:24,LUA_SUMMARY:none X-HE-Tag: tent66_58450f1df0d2c X-Filterd-Recvd-Size: 4253 Received: from youngberry.canonical.com (youngberry.canonical.com [91.189.89.112]) by imf03.hostedemail.com (Postfix) with ESMTP for ; Mon, 1 Jun 2020 16:06:46 +0000 (UTC) Received: from mail-wr1-f70.google.com ([209.85.221.70]) by youngberry.canonical.com with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.86_2) (envelope-from ) id 1jfmxY-0006s4-Vv for linux-mm@kvack.org; Mon, 01 Jun 2020 16:06:45 +0000 Received: by mail-wr1-f70.google.com with SMTP id c14so173927wrm.15 for ; Mon, 01 Jun 2020 09:06:44 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=bpQ13/Tb/1v9ESSJdhnUaEx5I/MEIqhF5at0rFUACNM=; b=o23ilthdT3dhZxojAFcSKVr2Qg+vxdJaGvFGrRZ37KVgks8kj52cPbItp7KeUQ4L0/ ZbzOZVYhqNY7jtrw8xgl+j3R7XZNmuB4/ZnOpuRorTqRC8NIsUEVjsDK9U/9Yur1LGdF g7ieaOB4ZUdj3MQZLRNT/nkqZ4GllTU0r4Lz6ELGPhyI8yoSWtXPbri/NwPEK9/m+uYa 0TVmH4tt+Srk8XW3M4sUlBUX5eGvL1pG4tH21lkAlL3GdZlpMAYACrtbsIXk4YsbYRYG hdeJwWefjQ13wTNi4DXKGLpFPIdAE4T5AZERoe34T7zWB6A5lZxmPPWFXhOrRjadBKvw vkXA== X-Gm-Message-State: AOAM531oix2tehHnf+KLJL8AMkSblhPq/uy4dZFmnXThGaWw081V2ppP 8omZiq4b+SJPvzB2lCITbWAQVPh1Uytiy6NFa2cgKE9GtXs5VGsKynfdr/9hMwZ/HCbcfWXVCXk 8X/mrwQD8ApC6gH5OXO95EtjmjAi4 X-Received: by 2002:adf:dc42:: with SMTP id m2mr11722687wrj.342.1591027604647; Mon, 01 Jun 2020 09:06:44 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwtIARnKWstXAKhlHKQE+KOrbq5RT+XW8IL/zXgEDl3x/r+gjZRu4PbPN3pWQtFh7apH9Bo4w== X-Received: by 2002:adf:dc42:: with SMTP id m2mr11722665wrj.342.1591027604369; Mon, 01 Jun 2020 09:06:44 -0700 (PDT) Received: from xps-13.homenet.telecomitalia.it (host105-135-dynamic.43-79-r.retail.telecomitalia.it. [79.43.135.105]) by smtp.gmail.com with ESMTPSA id k16sm19719262wrp.66.2020.06.01.09.06.42 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 01 Jun 2020 09:06:43 -0700 (PDT) From: Andrea Righi To: "Rafael J . Wysocki" , Pavel Machek Cc: Len Brown , Andrew Morton , linux-pm@vger.kernel.org, linux-mm@kvack.org, linux-kernel@vger.kernel.org Subject: [RFC PATCH 0/2] PM: hibernate: opportunistic memory reclaim Date: Mon, 1 Jun 2020 18:06:34 +0200 Message-Id: <20200601160636.148346-1-andrea.righi@canonical.com> X-Mailer: git-send-email 2.25.1 MIME-Version: 1.0 X-Rspamd-Queue-Id: 1E835141F2 X-Spamd-Result: default: False [0.00 / 100.00] X-Rspamd-Server: rspam05 X-Bogosity: Ham, tests=bogofilter, spamicity=0.001674, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: Here is the first attempt to provide an interface that allows user-space tasks to trigger an opportunistic memory reclaim before hibernating a system. Reclaiming memory in advance (e.g., when the system is idle) allows to reduce the size of the hibernation image and significantly speed up the time to hibernate and resume. The typical use case of this feature is to allow high-priority cloud instances to preempt low-priority instances (e.g., "spot" instances [1]) by hibernating them. Opportunistic memory reclaim is very effective to quickly hibernate instances that allocate a large chunk of memory and remain mostly idle for the majority of the time, only using a minimum working set. This topic has been mentioned during the OSPM 2020 conference [2]. See [RFC PATCH 2/2] for details about the proposed solution. Feedbacks are welcome. Thanks, -Andrea [1] https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/using-spot-instances.html [2] https://lwn.net/Articles/821158/ ---------------------------------------------------------------- Andrea Righi (2): mm: swap: allow partial swapoff with try_to_unuse() PM: hibernate: introduce opportunistic memory reclaim Documentation/ABI/testing/sysfs-power | 38 ++++++++++++++ include/linux/swapfile.h | 8 +++ kernel/power/hibernate.c | 94 ++++++++++++++++++++++++++++++++++- mm/swapfile.c | 45 ++++++++++++++--- 4 files changed, 176 insertions(+), 9 deletions(-)