Received: by 2002:a05:7412:7c14:b0:fa:6e18:a558 with SMTP id ii20csp315892rdb; Mon, 22 Jan 2024 05:18:00 -0800 (PST) X-Google-Smtp-Source: AGHT+IEG59TPkf93lwirMtphUnhNJH9gDyCQ8R57J3rRJ2qmoTsxDPbyuM3TJ1lDFP449lNwB2hK X-Received: by 2002:a05:6a21:a59a:b0:19b:5b08:1f4b with SMTP id gd26-20020a056a21a59a00b0019b5b081f4bmr4486812pzc.15.1705929480342; Mon, 22 Jan 2024 05:18:00 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1705929480; cv=pass; d=google.com; s=arc-20160816; b=hpWLALxJvNSKvHCAw5+hNiLFO5XG3e7nAta8gCQMwf0SzI8kAUAuuWxCedZ4OjGJ0E A8f1cUrDt+wpHMTO9NahEHK5Vs7kE8ueJyV9YLrSO6aWcw1XVpdN+U+GnwtravpEnOcB YcQyB+lm4mPl82rRbAS0k9mUPdnCgK+3GTujry67uoXdhwVRKEn3yIozhwJl+L8JSSjT czAOZCOAj7iLVG1FTxH9t6sNe4srojB4yuljUFYhRyYLP14abooM+9xZq4iJlgnoPmBm nFBw+7xzPH68FhFBd4RHiA4qmmhW1hOBM/puV1hxXtr9fDLJOoz1Jf6xfGqk4EkjsK+J nsBg== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=mime-version:list-unsubscribe:list-subscribe:list-id:precedence :message-id:date:subject:cc:to:from:dkim-signature; bh=ZtkcX/MfE5owMEhrjCNwUtd6yGeRWH2ZVRmmOAfHJIc=; fh=rWmd69z58WUTnU3ULJYt1qd3WLP4Y8eCvxmMjsddAFs=; b=ZdzkOGYJSeePjhfEfUSjm6PPzqrTH912gOcT8CeAiBQaM3yD8nKhFdFrVaH2tVYDq/ QdtzgAbiDIjgqnTvbyOr/cfTMl46oGrhpFYd+dZzcxksOL2X4DPI5Pp5+pO5hboIloZt 8N0WTYMtYOmBVOCfFNYXC3vyX2nGyqszgXVrnMebSH/mrsYkgI+mE8/zfXxjesWkNX98 AQM6ssdGUMptEz2jhfzLq25mCv7ny7fiBRnAcDaUxuiRd046Jzle4MvD33XeQ4lB1WK6 BrtrMiMQVy2k/GVYBoaasHfJ80ISlEQlaUiR8c/o0A8L98GoO9QcanUYVsgWXRbJpO2A T5Ww== ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@quicinc.com header.s=qcppdkim1 header.b=i8HXBNEM; arc=pass (i=1 spf=pass spfdomain=quicinc.com dkim=pass dkdomain=quicinc.com dmarc=pass fromdomain=quicinc.com); spf=pass (google.com: domain of linux-kernel+bounces-33081-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-33081-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=quicinc.com Return-Path: Received: from sv.mirrors.kernel.org (sv.mirrors.kernel.org. [2604:1380:45e3:2400::1]) by mx.google.com with ESMTPS id c6-20020a633506000000b005cec84d3ac8si8012111pga.638.2024.01.22.05.18.00 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 22 Jan 2024 05:18:00 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-33081-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) client-ip=2604:1380:45e3:2400::1; Authentication-Results: mx.google.com; dkim=pass header.i=@quicinc.com header.s=qcppdkim1 header.b=i8HXBNEM; arc=pass (i=1 spf=pass spfdomain=quicinc.com dkim=pass dkdomain=quicinc.com dmarc=pass fromdomain=quicinc.com); spf=pass (google.com: domain of linux-kernel+bounces-33081-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-33081-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=quicinc.com Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by sv.mirrors.kernel.org (Postfix) with ESMTPS id 83EDB2811E1 for ; Mon, 22 Jan 2024 13:16:43 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id E2DD83CF59; Mon, 22 Jan 2024 13:16:33 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=quicinc.com header.i=@quicinc.com header.b="i8HXBNEM" Received: from mx0b-0031df01.pphosted.com (mx0b-0031df01.pphosted.com [205.220.180.131]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 63AF53D0A0; Mon, 22 Jan 2024 13:16:31 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=205.220.180.131 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1705929393; cv=none; b=XC7Xbp7p7ja7RRKF5RPzVHITSIc/zXFBlVDLwx+Zoh5IgkAMr7+gyp/NZjSe5oayvJ2ANgeCRatUis3XCszAzG5XIluFx4HTTAhmTRdjqbHTSUTbl3PPp3lbJEVdm4gHVSV729OMShJejmKoKPumcnKoTjUAfWHmjNidXhOhIgM= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1705929393; c=relaxed/simple; bh=Q1m7h0F6DzQ/vkJJU6RqqEh9DBk1bEKm9OrtdMCbdAQ=; h=From:To:CC:Subject:Date:Message-ID:MIME-Version:Content-Type; b=rGnnYKFIekdh+73ewxmkkKfW0a3cBzOQpAnPcE5r8ptgQUN2Z24oApJV+yJjjy9IgQR0FsemscOskBcDPwGFRfZoXzaqyvwfpohp3vb0qUyW0V0BKCE9yrMSGH91D3KUSW9+T4DFXl2g+RcqRd88FwanDWrIUTUH6XINDXNAV28= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=quicinc.com; spf=pass smtp.mailfrom=quicinc.com; dkim=pass (2048-bit key) header.d=quicinc.com header.i=@quicinc.com header.b=i8HXBNEM; arc=none smtp.client-ip=205.220.180.131 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=quicinc.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=quicinc.com Received: from pps.filterd (m0279869.ppops.net [127.0.0.1]) by mx0a-0031df01.pphosted.com (8.17.1.24/8.17.1.24) with ESMTP id 40MCYFRe028209; Mon, 22 Jan 2024 13:16:08 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=quicinc.com; h= from:to:cc:subject:date:message-id:mime-version:content-type; s= qcppdkim1; bh=ZtkcX/MfE5owMEhrjCNwUtd6yGeRWH2ZVRmmOAfHJIc=; b=i8 HXBNEM5evjmD9D1yTuwc1JCzeggkgV1/69+qP5eWtopUhHmyd/Mo1TiD0YekgweI ljR13zdCQKrWbGt2oWEADy/2wYzGe0u7oDZN6GezoYUeWm04HjdHw0HXm57Gd3Us 8dYe0yla0mqA5Ox3E5KALmNxfscH0H/jfswLoawMbBs3vHWsI+1tSdn/Z3ZLh3d1 a/k7tssgqHpRydBose5dam9DnYtAlUCBT39f6b6UgSsDD6Qg4xxAsAyMJDOu3kzK SHdD7YRhW82PV37yqaeO+xip4WdvUFFQsxroRRxdtDAzAAEzlCeoMhSreWiQFo0+ RjGt8ulwQZ2YVRdRJbTQ== Received: from nalasppmta05.qualcomm.com (Global_NAT1.qualcomm.com [129.46.96.20]) by mx0a-0031df01.pphosted.com (PPS) with ESMTPS id 3vspw8rf98-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Mon, 22 Jan 2024 13:16:07 +0000 (GMT) Received: from nalasex01b.na.qualcomm.com (nalasex01b.na.qualcomm.com [10.47.209.197]) by NALASPPMTA05.qualcomm.com (8.17.1.5/8.17.1.5) with ESMTPS id 40MDG6E4013327 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Mon, 22 Jan 2024 13:16:06 GMT Received: from hu-nprakash-blr.qualcomm.com (10.80.80.8) by nalasex01b.na.qualcomm.com (10.47.209.197) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.1118.40; Mon, 22 Jan 2024 05:16:00 -0800 From: Nikhil V To: Len Brown , "Rafael J. Wysocki" , Pavel Machek CC: Nikhil V , Jonathan Corbet , Peter Zijlstra , "Paul E. McKenney" , "Steven Rostedt (Google)" , "Tejun Heo" , Yan-Jie Wang , Randy Dunlap , Catalin Marinas , , , , , , , , , Subject: [PATCH v3 0/4] PM: hibernate: LZ4 compression support Date: Mon, 22 Jan 2024 18:45:24 +0530 Message-ID: X-Mailer: git-send-email 2.17.1 Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain X-ClientProxiedBy: nasanex01a.na.qualcomm.com (10.52.223.231) To nalasex01b.na.qualcomm.com (10.47.209.197) X-QCInternal: smtphost X-Proofpoint-Virus-Version: vendor=nai engine=6200 definitions=5800 signatures=585085 X-Proofpoint-GUID: w1dCeyiSx-DKrRBH32VbOBwxbjoNW5-Y X-Proofpoint-ORIG-GUID: w1dCeyiSx-DKrRBH32VbOBwxbjoNW5-Y X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.272,Aquarius:18.0.1011,Hydra:6.0.619,FMLib:17.11.176.26 definitions=2024-01-22_02,2024-01-22_01,2023-05-22_02 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 phishscore=0 malwarescore=0 adultscore=0 mlxscore=0 spamscore=0 lowpriorityscore=0 bulkscore=0 clxscore=1011 suspectscore=0 impostorscore=0 mlxlogscore=999 priorityscore=1501 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.19.0-2311290000 definitions=main-2401220093 This patch series covers the following: 1. Renaming lzo* to generic names, except for lzo_xxx() APIs. This is used in the next patch where we move to crypto based APIs for compression. There are no functional changes introduced by this approach. 2. Replace LZO library calls with crypto generic APIs Currently for hibernation, LZO is the only compression algorithm available and uses the existing LZO library calls. However, there is no flexibility to switch to other algorithms which provides better results. The main idea is that different compression algorithms have different characteristics and hibernation may benefit when it uses alternate algorithms. By moving to crypto based APIs, it lays a foundation to use other compression algorithms for hibernation. 3. LZ4 compression Extend the support for LZ4 compression to be used with hibernation. The main idea is that different compression algorithms have different characteristics and hibernation may benefit when it uses any of these algorithms: a default algorithm, having higher compression rate but is slower(compression/decompression) and a secondary algorithm, that is faster(compression/decompression) but has lower compression rate. LZ4 algorithm has better decompression speeds over LZO. This reduces the hibernation image restore time. As per test results: LZO LZ4 Size before Compression(bytes) 682696704 682393600 Size after Compression(bytes) 146502402 155993547 Decompression Rate 335.02 MB/s 501.05 MB/s Restore time 4.4s 3.8s LZO is the default compression algorithm used for hibernation. Enable CONFIG_HIBERNATION_DEF_COMP_LZ4 to set the default compressor as LZ4. Compression Benchmarks: https://github.com/lz4/lz4 4. Support to select compression algorithm Currently the default compression algorithm is selected based on Kconfig. Introduce a kernel command line parameter "hib_compression" to override this behaviour. Users can set "hib_compression" command line parameter to specify the algorithm. Usage: LZO: hib_compression=lzo LZ4: hib_compression=lz4 LZO is the default compression algorithm used with hibernation. Changes in v3: - Rebased to v6.8-rc1 after resolving the minor conflicts. - Link to v2: https://lore.kernel.org/all/cover.1700048610.git.quic_nprakash@quicinc.com/ Changes in v2: - Fixed build issues reported by kernel test robot for ARCH=sh, [1]. [1] https://lore.kernel.org/oe-kbuild-all/202310171226.pLUPeuC7-lkp@intel.com/ - Link to v1: https://lore.kernel.org/all/cover.1696410298.git.quic_nprakash@quicinc.com/ Nikhil V (4): PM: hibernate: Rename lzo* to make it generic PM: hibernate: Move to crypto APIs for LZO compression PM: hibernate: Add support for LZ4 compression for hibernation PM: hibernate: Support to select compression algorithm .../admin-guide/kernel-parameters.txt | 6 + kernel/power/Kconfig | 26 ++- kernel/power/hibernate.c | 85 +++++++- kernel/power/power.h | 19 ++ kernel/power/swap.c | 189 +++++++++++------- 5 files changed, 251 insertions(+), 74 deletions(-) base-commit: 6613476e225e090cc9aad49be7fa504e290dd33d -- 2.17.1