Message ID | cover.1705927916.git.quic_nprakash@quicinc.com |
---|---|
Headers |
Return-Path: <linux-kernel+bounces-33081-ouuuleilei=gmail.com@vger.kernel.org> Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:7301:2bc4:b0:101:a8e8:374 with SMTP id hx4csp2578799dyb; Mon, 22 Jan 2024 05:48:29 -0800 (PST) X-Google-Smtp-Source: AGHT+IE4Vor1griy4ymBX6/p5DzsnP4CaJkkbXLtweFGVdAe5B8zrvpBKyycntcOeWm7X2qzTtaJ X-Received: by 2002:a17:902:b608:b0:1d4:ceab:58b9 with SMTP id b8-20020a170902b60800b001d4ceab58b9mr4141620pls.40.1705931309076; Mon, 22 Jan 2024 05:48:29 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1705931309; cv=pass; d=google.com; s=arc-20160816; b=M4zwDwytwopdSofX1l4R4a84bHabNG4Qld5lqkHxBkJ3tiy5Xs8kp219BDpIv0n4Ir gY4As1XG+2cmm9zeITLjeOzy6Fao4zhXxbWYqraKrVFohEj9+u6Bcsw4/xO46t9RU4nB Vp4TjPiE44tHr/sl0nu7NTJ6+cr5MiZG76ODqsfniMW9OXWB+ldqSGWZm5yPKKDf2/LK bhW0OPVTJxCU7lFxexsrHSoYaU5MFBuYu5Vb78oEjWpA0mEyJ/vR232/ypIHvj0G0TPo F83CmKEZKGX5fTknc9fX4RaNMOB2asl3jY9WLbFjCSMfG0udjYG96ijOtv72PGKgEVTf 2L/A== 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-ouuuleilei=gmail.com@vger.kernel.org designates 2604:1380:40f1:3f00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-33081-ouuuleilei=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=quicinc.com Received: from sy.mirrors.kernel.org (sy.mirrors.kernel.org. [2604:1380:40f1:3f00::1]) by mx.google.com with ESMTPS id o17-20020a170902d4d100b001d735ba6a21si3714832plg.32.2024.01.22.05.48.28 for <ouuuleilei@gmail.com> (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 22 Jan 2024 05:48:29 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-33081-ouuuleilei=gmail.com@vger.kernel.org designates 2604:1380:40f1:3f00::1 as permitted sender) client-ip=2604:1380:40f1:3f00::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-ouuuleilei=gmail.com@vger.kernel.org designates 2604:1380:40f1:3f00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-33081-ouuuleilei=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 sy.mirrors.kernel.org (Postfix) with ESMTPS id 5257FB276C5 for <ouuuleilei@gmail.com>; Mon, 22 Jan 2024 13:17:00 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 0A8633D0B3; Mon, 22 Jan 2024 13:16:36 +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 <quic_nprakash@quicinc.com> To: Len Brown <len.brown@intel.com>, "Rafael J. Wysocki" <rafael@kernel.org>, Pavel Machek <pavel@ucw.cz> CC: Nikhil V <quic_nprakash@quicinc.com>, Jonathan Corbet <corbet@lwn.net>, Peter Zijlstra <peterz@infradead.org>, "Paul E. McKenney" <paulmck@kernel.org>, "Steven Rostedt (Google)" <rostedt@goodmis.org>, "Tejun Heo" <tj@kernel.org>, Yan-Jie Wang <yanjiewtw@gmail.com>, Randy Dunlap <rdunlap@infradead.org>, Catalin Marinas <catalin.marinas@arm.com>, <linux-doc@vger.kernel.org>, <linux-kernel@vger.kernel.org>, <linux-pm@vger.kernel.org>, <quic_pkondeti@quicinc.com>, <quic_kprasan@quicinc.com>, <quic_mpilaniy@quicinc.com>, <quic_shrekk@quicinc.com>, <mpleshivenkov@google.com>, <ericyin@google.com> Subject: [PATCH v3 0/4] PM: hibernate: LZ4 compression support Date: Mon, 22 Jan 2024 18:45:24 +0530 Message-ID: <cover.1705927916.git.quic_nprakash@quicinc.com> X-Mailer: git-send-email 2.17.1 Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: <linux-kernel.vger.kernel.org> List-Subscribe: <mailto:linux-kernel+subscribe@vger.kernel.org> List-Unsubscribe: <mailto:linux-kernel+unsubscribe@vger.kernel.org> 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 X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1782632714107049316 X-GMAIL-MSGID: 1788798628585936387 |
Series |
PM: hibernate: LZ4 compression support
|
|
Message
Nikhil V
Jan. 22, 2024, 1:15 p.m. UTC
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
Comments
On Mon, Jan 22, 2024 at 2:16 PM Nikhil V <quic_nprakash@quicinc.com> wrote: > > 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/ I've applied the first 3 patches in the series (as 6.9 material), but I'm not particularly happy with the last one. First off, I'm not sure if a kernel command line parameter is the most convenient way of selecting the compression algorithm. Since (AFAICS) the restore kernel will detect the compression algo in use anyway (or at least it can be made do so), a modparam should work for this and it would be far more convenient to use. Second, if I can be convinced that indeed, using a kernel command line option for this is the way to go, I don't particularly like the name used in that patch. Please feel free to send a replacement for patch [4/4] separately. Thanks!
On 1/31/2024 7:50 PM, Rafael J. Wysocki wrote: > On Mon, Jan 22, 2024 at 2:16 PM Nikhil V <quic_nprakash@quicinc.com> wrote: >> >> 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/ > > I've applied the first 3 patches in the series (as 6.9 material), but > I'm not particularly happy with the last one. > > First off, I'm not sure if a kernel command line parameter is the most > convenient way of selecting the compression algorithm. Since (AFAICS) > the restore kernel will detect the compression algo in use anyway (or > at least it can be made do so), a modparam should work for this and it > would be far more convenient to use. > > Second, if I can be convinced that indeed, using a kernel command line > option for this is the way to go, I don't particularly like the name > used in that patch. > > Please feel free to send a replacement for patch [4/4] separately. > > Thanks! Hi @Rafael, Thanks for the update. Regarding patch[4/4], will work on modifying the code as mentioned by adding module parameter instead of kernel cmdline parameter. Will send a separate patch for this after testing with the changes. Thanks for the input. Thanks, Nikhil V