Message ID | cover.1695711299.git.quic_nprakash@quicinc.com |
---|---|
Headers |
Return-Path: <linux-kernel-owner@vger.kernel.org> Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:cae8:0:b0:403:3b70:6f57 with SMTP id r8csp2117808vqu; Tue, 26 Sep 2023 11:37:48 -0700 (PDT) X-Google-Smtp-Source: AGHT+IEB9rSseQaWrpEeVV+tb7hE4vm+LvKyz/jAnx8Y5R13SMN9pChQXRGW6I5yjRavYnUMq14z X-Received: by 2002:a17:902:d2d1:b0:1be:384:7b29 with SMTP id n17-20020a170902d2d100b001be03847b29mr13141994plc.34.1695753468659; Tue, 26 Sep 2023 11:37:48 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1695753468; cv=none; d=google.com; s=arc-20160816; b=qK/JkVQDJPQ+H5nHRS1Ol8mF//YfdzMvYfVp+jahS8pFFsgxKec4/jOgx+venSJxft mEvhUjgh5GSuaHJHjsbX8Vm/36EeHLeoXymo+O76R2oDuaKXw3Q+lyL1fQv6eUdzHvPn nlSaDWXXbSM/UpIJ33zBXXB31DiUxiwUmwl39ohzuNSv6/FxSTCe8htOWQ0xX0c46D7D 3bCamu/ru5LtqTQVk5U2xU4OkRmXrwdLcgPvzw3UMTBdGXNG/O0Xii45Tk6/4YLPbIk7 DoHMncdGVp/oGPthmNLwWr5YZ8jtSXZeBnFVjGbkyytMAg3k54173ZAeCptKT+JUEKLm O6SQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:mime-version:message-id:date:subject:cc:to:from :dkim-signature; bh=7wYr2f7GR/gnOln58QFT1dBmpK5rOQQPXNbgSsX6x7A=; fh=Ebdsj6948I8DQLilGLvOr1Ck3XQBox6m0OVohSX2THU=; b=Ai9uTFLSjgd4yYpT1PPLH29HBcUe4vgXALufIVYZyrlcXwv46DQP3bFImUPVUENVlE NtPk71sMLmWf8z96LdA+61zES5Bfj7S/GRYL6WJeSKFrF3G/SInDaSxE83L83DRnQeBF 90EIhaaLNFQLdPEhBDIOLsFf+7y0OuLFR3SHy9pf9NI97Hcy2mf5MmpP9noWWzxzJ2ER X5ZU9AJSIzVxgXD0Vi+gQMM/JIi580uTgNGhn4Wt9kKmELVGqSVgrmb8yD7tQGxyxDsn b7+qqk1PJrzwfAxr+COpFVfNjnMIAsc/EV2koZazI1qHIMBc0eQqYcVnCGQVOS1L1FmV 7Mhw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@quicinc.com header.s=qcppdkim1 header.b=VJYG7Sqe; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:6 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=quicinc.com Received: from pete.vger.email (pete.vger.email. [2620:137:e000::3:6]) by mx.google.com with ESMTPS id u12-20020a170902e5cc00b001c5c344a425si7036898plf.418.2023.09.26.11.37.45 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 26 Sep 2023 11:37:48 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:6 as permitted sender) client-ip=2620:137:e000::3:6; Authentication-Results: mx.google.com; dkim=pass header.i=@quicinc.com header.s=qcppdkim1 header.b=VJYG7Sqe; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:6 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=quicinc.com Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by pete.vger.email (Postfix) with ESMTP id B2D8B81A8A38; Tue, 26 Sep 2023 01:58:56 -0700 (PDT) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.10 at pete.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234024AbjIZI6t (ORCPT <rfc822;ruipengqi7@gmail.com> + 27 others); Tue, 26 Sep 2023 04:58:49 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:33646 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233904AbjIZI6q (ORCPT <rfc822;linux-kernel@vger.kernel.org>); Tue, 26 Sep 2023 04:58:46 -0400 Received: from mx0b-0031df01.pphosted.com (mx0b-0031df01.pphosted.com [205.220.180.131]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 29D9FDE; Tue, 26 Sep 2023 01:58:40 -0700 (PDT) Received: from pps.filterd (m0279873.ppops.net [127.0.0.1]) by mx0a-0031df01.pphosted.com (8.17.1.19/8.17.1.19) with ESMTP id 38Q7LYfV031306; Tue, 26 Sep 2023 08:58:19 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=7wYr2f7GR/gnOln58QFT1dBmpK5rOQQPXNbgSsX6x7A=; b=VJYG7SqeMLFi0Wl6wJX7kQKkiiFFPHF7eibcUoSQUfLsd3o5EvWqe8VIh4Jp2YQlvT3h 95Ny7kF5Ol4p5VN1468qV6Y5EkSJ4UjcnX2cHke5Kup21AxnF7vpWn+0VD8nrwZDi4Gn Wv9Dwi+pMB6He1ibDxqvEVJmF+QqljEJcFX1epZaaot2r+E+RBkH8Vv3MHiQsFlZVyvo TVhauB4Kycb2RMNNUNPb2qMbGEB2AvP6nBWiMsunLaDQkxn3Oy5bcO/VxfaaO7gtugMD XVBmw/olIDBfnqG+qZyx/JkVo3ATFEfJ9gybqUfvTRjVisje0OkBu/fl5YVbSWdXKSTE EQ== Received: from nalasppmta01.qualcomm.com (Global_NAT1.qualcomm.com [129.46.96.20]) by mx0a-0031df01.pphosted.com (PPS) with ESMTPS id 3tb72sjs4u-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Tue, 26 Sep 2023 08:58:19 +0000 Received: from nalasex01b.na.qualcomm.com (nalasex01b.na.qualcomm.com [10.47.209.197]) by NALASPPMTA01.qualcomm.com (8.17.1.5/8.17.1.5) with ESMTPS id 38Q8wIM4021387 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Tue, 26 Sep 2023 08:58:18 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.36; Tue, 26 Sep 2023 01:58:11 -0700 From: Nikhil V <quic_nprakash@quicinc.com> To: Pavel Machek <pavel@ucw.cz>, Len Brown <len.brown@intel.com>, "Rafael J. Wysocki" <rafael@kernel.org> CC: Nikhil V <quic_nprakash@quicinc.com>, Jonathan Corbet <corbet@lwn.net>, Catalin Marinas <catalin.marinas@arm.com>, Randy Dunlap <rdunlap@infradead.org>, Peter Zijlstra <peterz@infradead.org>, "Steven Rostedt (Google)" <rostedt@goodmis.org>, "Paul E. McKenney" <paulmck@kernel.org>, Tejun Heo <tj@kernel.org>, <linux-kernel@vger.kernel.org>, <linux-doc@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: [RFC PATCH 0/4] PM: hibernate: LZ4 compression support Date: Tue, 26 Sep 2023 14:27:10 +0530 Message-ID: <cover.1695711299.git.quic_nprakash@quicinc.com> X-Mailer: git-send-email 2.17.1 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 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: 8WVn62nEL_LK_j0_t81CxRwApjZC6T-B X-Proofpoint-ORIG-GUID: 8WVn62nEL_LK_j0_t81CxRwApjZC6T-B X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.267,Aquarius:18.0.980,Hydra:6.0.619,FMLib:17.11.176.26 definitions=2023-09-26_07,2023-09-25_01,2023-05-22_02 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 impostorscore=0 phishscore=0 mlxscore=0 priorityscore=1501 lowpriorityscore=0 clxscore=1011 malwarescore=0 adultscore=0 mlxlogscore=999 spamscore=0 suspectscore=0 bulkscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2309180000 definitions=main-2309260078 X-Spam-Status: No, score=-0.9 required=5.0 tests=DKIM_SIGNED,DKIM_VALID, DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI, SPF_HELO_NONE,SPF_PASS autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on pete.vger.email Precedence: bulk List-ID: <linux-kernel.vger.kernel.org> X-Mailing-List: linux-kernel@vger.kernel.org X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (pete.vger.email [0.0.0.0]); Tue, 26 Sep 2023 01:58:56 -0700 (PDT) X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1778126389010270186 X-GMAIL-MSGID: 1778126389010270186 |
Series |
PM: hibernate: LZ4 compression support
|
|
Message
Nikhil V
Sept. 26, 2023, 8:57 a.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. 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 | 25 ++- kernel/power/hibernate.c | 83 +++++++- kernel/power/power.h | 19 ++ kernel/power/swap.c | 189 +++++++++++------- 5 files changed, 248 insertions(+), 74 deletions(-)
Comments
On 9/26/2023 2:27 PM, Nikhil V 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. > > 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 | 25 ++- > kernel/power/hibernate.c | 83 +++++++- > kernel/power/power.h | 19 ++ > kernel/power/swap.c | 189 +++++++++++------- > 5 files changed, 248 insertions(+), 74 deletions(-) > Hi, Could you please let me know if you have any concerns/comments on this approach? If there are no comments, I could push another patch series with PATCH tag for review. Thanks Nikhil V
On Tue, Sep 26, 2023 at 02:27:10PM +0530, Nikhil V 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. > > 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 | 25 ++- > kernel/power/hibernate.c | 83 +++++++- > kernel/power/power.h | 19 ++ > kernel/power/swap.c | 189 +++++++++++------- > 5 files changed, 248 insertions(+), 74 deletions(-) > I have tested this series on x86 QEMU with v6.6-rc3 (plus another patch from pm-next tree i.e "PM: hibernate: use __get_safe_page() rather than touching the list"). It works as advertised. Thanks, Pavan