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 Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by smtp.lore.kernel.org (Postfix) with ESMTP id 35EB1C4332F for ; Wed, 18 May 2022 07:49:20 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id C3FA86B0078; Wed, 18 May 2022 03:49:19 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id BEEE56B007B; Wed, 18 May 2022 03:49:19 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id AB6BF6B007D; Wed, 18 May 2022 03:49:19 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0010.hostedemail.com [216.40.44.10]) by kanga.kvack.org (Postfix) with ESMTP id 9DE4D6B0078 for ; Wed, 18 May 2022 03:49:19 -0400 (EDT) Received: from smtpin07.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay13.hostedemail.com (Postfix) with ESMTP id 6BC8C605A7 for ; Wed, 18 May 2022 07:49:19 +0000 (UTC) X-FDA: 79478088438.07.3FDF444 Received: from alexa-out-sd-02.qualcomm.com (alexa-out-sd-02.qualcomm.com [199.106.114.39]) by imf22.hostedemail.com (Postfix) with ESMTP id 610A9C00D6 for ; Wed, 18 May 2022 07:49:16 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=quicinc.com; i=@quicinc.com; q=dns/txt; s=qcdkim; t=1652860158; x=1684396158; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version; bh=rOYdWmdQCnEpAHcJFCYdRtOeaAOYF7eoFxilIXHP6Bo=; b=f76IxhdMGRpcFIVZl4IoTOvtiIGxMgmbcF5O68qO3WRp3t0i5EFlC3nQ GP2f97x2etzlO2ZE3TygF0xsWdZsNTQTcZEDjgvE+cYvxJvuRuRLVpGse YjdmChiVaYpg0oHfvMguDJ/JPDTve9Qy17U7qma1wL+izhjsTabITBwxt Y=; Received: from unknown (HELO ironmsg05-sd.qualcomm.com) ([10.53.140.145]) by alexa-out-sd-02.qualcomm.com with ESMTP; 18 May 2022 00:49:17 -0700 X-QCInternal: smtphost Received: from unknown (HELO nasanex01a.na.qualcomm.com) ([10.52.223.231]) by ironmsg05-sd.qualcomm.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 18 May 2022 00:49:17 -0700 Received: from blr-ubuntu-185.qualcomm.com (10.80.80.8) by nasanex01a.na.qualcomm.com (10.52.223.231) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.986.22; Wed, 18 May 2022 00:49:09 -0700 From: Vivek Kumar To: , , , , , , , , , , , , , CC: , , , , , , , , , , , , , , Vivek Kumar , Prasanna Kumar Subject: [RFC 2/6] PM: Hibernate: Add option to disable disk offset randomization Date: Wed, 18 May 2022 13:18:37 +0530 Message-ID: <1652860121-24092-3-git-send-email-quic_vivekuma@quicinc.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1652860121-24092-1-git-send-email-quic_vivekuma@quicinc.com> References: <1652860121-24092-1-git-send-email-quic_vivekuma@quicinc.com> MIME-Version: 1.0 Content-Type: text/plain X-Originating-IP: [10.80.80.8] X-ClientProxiedBy: nasanex01a.na.qualcomm.com (10.52.223.231) To nasanex01a.na.qualcomm.com (10.52.223.231) X-Rspamd-Queue-Id: 610A9C00D6 X-Stat-Signature: 1fyq5z67x3dgw61sert86iqnyndbnm1d Authentication-Results: imf22.hostedemail.com; dkim=pass header.d=quicinc.com header.s=qcdkim header.b=f76IxhdM; dmarc=pass (policy=none) header.from=quicinc.com; spf=pass (imf22.hostedemail.com: domain of quic_vivekuma@quicinc.com designates 199.106.114.39 as permitted sender) smtp.mailfrom=quic_vivekuma@quicinc.com X-Rspam-User: X-Rspamd-Server: rspam08 X-HE-Tag: 1652860156-662686 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: Add a kernel parameter to disable the disk offset randomization for SSD devices in which such feature is available at the firmware level. This is helpful in improving hibernation resume time. Signed-off-by: Vivek Kumar Signed-off-by: Prasanna Kumar --- Documentation/admin-guide/kernel-parameters.txt | 11 +++++++++++ kernel/power/swap.c | 9 +++++++++ 2 files changed, 20 insertions(+) diff --git a/Documentation/admin-guide/kernel-parameters.txt b/Documentation/admin-guide/kernel-parameters.txt index 666ade9..06b4f10 100644 --- a/Documentation/admin-guide/kernel-parameters.txt +++ b/Documentation/admin-guide/kernel-parameters.txt @@ -5192,6 +5192,17 @@ Useful for devices that are detected asynchronously (e.g. USB and MMC devices). + noswap_randomize + Kernel uses random disk offsets to help with wear-levelling + of SSD devices, while saving the hibernation snapshot image to + disk. Use this parameter to disable this feature for SSD + devices in scenarios when, such randomization is addressed at + the firmware level and hibenration image is not re-generated + frequently. + (Useful for improving hibernation resume time as snapshot pages + are available in disk serially and can be read in bigger chunks + without seeking) + retain_initrd [RAM] Keep initrd memory after extraction rfkill.default_state= diff --git a/kernel/power/swap.c b/kernel/power/swap.c index 91fffdd..8d5c811 100644 --- a/kernel/power/swap.c +++ b/kernel/power/swap.c @@ -44,6 +44,7 @@ u32 swsusp_hardware_signature; */ static bool clean_pages_on_read; static bool clean_pages_on_decompress; +static bool noswap_randomize; /* * The swap map is a data structure used for keeping track of each page @@ -1616,3 +1617,11 @@ static int __init swsusp_header_init(void) } core_initcall(swsusp_header_init); + +static int __init noswap_randomize_setup(char *str) +{ + noswap_randomize = true; + return 1; +} + +__setup("noswap_randomize", noswap_randomize_setup); -- 2.7.4