Received: by 2002:a25:683:0:0:0:0:0 with SMTP id 125csp590850ybg; Mon, 1 Jun 2020 09:09:03 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyNKLtejxaxlNFRCC3/1nW1Xw8GK+I5c/grmCNTzqD8ckKptsq/iAwllnda6LIkSXkDAtK3 X-Received: by 2002:a17:906:86c5:: with SMTP id j5mr19755761ejy.88.1591027743001; Mon, 01 Jun 2020 09:09:03 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1591027742; cv=none; d=google.com; s=arc-20160816; b=bkzOqCi0fzaZ9cQtLsHbcAv9HPhb9S5h/ydqd56rbTu5RB6pZZSVwX34zOPaWKSOse ZBnKMlUB70+UdqIAtBQN9f4nukcGKaIXnnGqs3tvB2AUSpuvlcHS8HjWfYqIRai92fp1 tjL7rKtoB98E2ds3XRznaBtaRGAM+oSOhI4YXimXmqgfX/DIGLjGYCSU11We66XEaVbA 1FcbKGm8sBB/EA39YiI0NrnqKOnPXREo/ZA2ur8wPTZ9sPbTec3WwxmWRvrdG1XXZDOK ik+lPevlmkCUq0hEhEOU8FRhK6VEQ6CPktf90QH+NrQcyUxb853dtQRmubtCY8NU5nhP I2fg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :message-id:date:subject:cc:to:from; bh=bpQ13/Tb/1v9ESSJdhnUaEx5I/MEIqhF5at0rFUACNM=; b=HbsWGMe39kMyAXvCFmBj7eq8VxqA2AmphvIuoEUpq77dLh0+2uTWJpQJPmeiotoiSU L/jzn9fcfgffVIlpOmPAtnKpo/mnl3CM0F6BllpsQfHNN8K8f16cPmlnpfbgMIicNVCS legK6T2LbvVp+GpEY1MGRKMvrnj8v59Sdz9V9mB7M9AUF6ZSbGSZzcMHNzLMlzZr26xe ULeFqgj9VQGt5U8DwRg6c7FfVBIUHag8qLickyh0tzWUNgDXgjKj/g4PToIATRrhDsEX bp0igeFd1zV1LJm3+4wf97mOZvffK0YDKkn1sPMFUkZ1nJwJBVIdirZO2O3QqBkEeG/r s3JQ== 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; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=canonical.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id dt17si8543453ejc.457.2020.06.01.09.08.39; Mon, 01 Jun 2020 09:09:02 -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; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=canonical.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726962AbgFAQGs (ORCPT + 99 others); Mon, 1 Jun 2020 12:06:48 -0400 Received: from youngberry.canonical.com ([91.189.89.112]:55315 "EHLO youngberry.canonical.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726067AbgFAQGr (ORCPT ); Mon, 1 Jun 2020 12:06:47 -0400 Received: from mail-wr1-f72.google.com ([209.85.221.72]) by youngberry.canonical.com with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.86_2) (envelope-from ) id 1jfmxZ-0006s6-01 for linux-kernel@vger.kernel.org; Mon, 01 Jun 2020 16:06:45 +0000 Received: by mail-wr1-f72.google.com with SMTP id t5so167836wro.20 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=i7bYUu4pdZdA18BL3W0+kRh8UhQy3lFKdi0oESXHxrfYBQeEPrB1XQ7gDYpqBDWZSS W6EJIbu6PPs5PF44jAm/94FsMO6m2fuubvTpn1eWL9BcTWwln7Vwf4g2f4+MY7fKMutk 2HPtEcourqj7mZuB8qttghShGDX4dF2uEm1rssyi/ONd4rqXfy/b0fatzZYIjEEAIZlq vGVLkK/RwqTXf4vOwszkjO9d1/c9zPgvy6wutRQw+RhvAHehM63k3bcXMPsL4nYYKPtj NCerwlArbpj4fCc1hDw62Q2F21swqgq2CXbKqci+/Lf0uMB1YIZwIMmsUeoBeyWgNsAn /gqQ== X-Gm-Message-State: AOAM533HjziedlMoshKuMT+VrYzv1GMCuN8gR27dAXF05/0I/TQmr7ad ZB9ecaSr1FQZP3bJyb+S+hmUYYQXUFSyQvVQaSo1sw8xR/PyBwDrey51DtBOs5bIPnNfRkDn/Nc 006w/RKhWWcwQ5p+WxULpfm10BYF10iEO+4U2RQCJcg== X-Received: by 2002:adf:dc42:: with SMTP id m2mr11722690wrj.342.1591027604648; Mon, 01 Jun 2020 09:06:44 -0700 (PDT) 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 Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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(-)