From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754818AbeDDBkc (ORCPT ); Tue, 3 Apr 2018 21:40:32 -0400 Received: from mail-pl0-f50.google.com ([209.85.160.50]:39674 "EHLO mail-pl0-f50.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753733AbeDDBka (ORCPT ); Tue, 3 Apr 2018 21:40:30 -0400 X-Google-Smtp-Source: AIpwx4+kSTH0uP09qpBjkKEqhgXPNxARIUjy/sb4fjRuNZZOlbyOJeo8vgf+25ypnJeNO+PYxfCgZg== Date: Wed, 4 Apr 2018 10:40:23 +0900 From: Sergey Senozhatsky To: Vaneet Narang Cc: Maninder Singh , "sergey.senozhatsky.work@gmail.com" , "herbert@gondor.apana.org.au" , "davem@davemloft.net" , "minchan@kernel.org" , "ngupta@vflare.org" , "keescook@chromium.org" , "anton@enomsg.org" , "ccross@android.com" , "tony.luck@intel.com" , "akpm@linux-foundation.org" , "colin.king@canonical.com" , "linux-crypto@vger.kernel.org" , "linux-kernel@vger.kernel.org" , PANKAJ MISHRA , AMIT SAHRAWAT Subject: Re: [PATCH 1/1] lz4: Implement lz4 with dynamic offset length. Message-ID: <20180404014023.GA5087@jagdpanzerIV> References: <20180403122642.GA26934@jagdpanzerIV> <20180321074948.GA2746@jagdpanzerIV> <1521607242-3968-1-git-send-email-maninder1.s@samsung.com> <1521607242-3968-2-git-send-email-maninder1.s@samsung.com> <20180402055152epcms5p546fdb62381b769ed0c719f3bedcee3b8@epcms5p5> <576192949.596772.1522763027665.JavaMail.jboss@ep1ml501> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <576192949.596772.1522763027665.JavaMail.jboss@ep1ml501> User-Agent: Mutt/1.9.4 (2018-02-28) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On (04/03/18 19:13), Vaneet Narang wrote: > Hi Sergey, > > >You shrink a 2 bytes offset down to a 1 byte offset, thus you enforce that > 2 Byte offset is not shrinked to 1 byte, Its only 1 bit is reserved out of > 16 bits of offset. So only 15 Bits can be used to store offset value. Yes, you are right. My bad, was thinking about something else. > >'page should be less than 32KB', which I'm sure will be confusing. > lz4_dyn will work on bigger data length(> 32k) but in that case compression > ratio may not be better than LZ4. This is same as LZ4 compressing data more > than 64K (16Bits). LZ4 can't store offset more than 64K similarly > LZ4 dyn can't store offset more than 32K. Then drop that `if PAGE_SIZE' thing. I'd rather do that stuff internally in lz4... if it needed at all. > >And you > >rely on lz4_dyn users to do the right thing - namely, to use that 'nice' > >`#if (PAGE_SIZE < (32 * KB))'. > They don't need to add this code Then drop it. > >Apart from that, lz4_dyn supports only data > >in up to page_size chunks. Suppose my system has page_size of less than 32K, > >so I legitimately can enable lz4_dyn, but suppose that I will use it > >somewhere where I don't work with page_size-d chunks. Will I able to just > >do tfm->compress(src, sz) on random buffers? The whole thing looks to be > >quite fragile. > No thats not true, lz4_dyn can work for random buffers and it need not be > of page size chunks. There is no difference in Lz4 and Lz4 dyn working. You are right. -ss