From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1757992AbcCVAhr (ORCPT ); Mon, 21 Mar 2016 20:37:47 -0400 Received: from LGEAMRELO11.lge.com ([156.147.23.51]:36588 "EHLO lgeamrelo11.lge.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1750787AbcCVAhq (ORCPT ); Mon, 21 Mar 2016 20:37:46 -0400 X-Original-SENDERIP: 156.147.1.151 X-Original-MAILFROM: minchan@kernel.org X-Original-SENDERIP: 165.244.98.204 X-Original-MAILFROM: minchan@kernel.org X-Original-SENDERIP: 10.177.223.161 X-Original-MAILFROM: minchan@kernel.org Date: Tue, 22 Mar 2016 09:39:00 +0900 From: Minchan Kim To: Sergey Senozhatsky CC: Sergey Senozhatsky , Andrew Morton , linux-kernel@vger.kernel.org Subject: Re: [PATCH] zram: export the number of available comp streams Message-ID: <20160322003900.GC27197@bbox> References: <1453809839-21705-1-git-send-email-sergey.senozhatsky@gmail.com> <20160129072842.GA30072@bbox> <20160201010157.GA1033@swordfish> <20160318003236.GB2154@bbox> <20160318010937.GA572@swordfish> <20160318012524.GA10612@bbox> <20160321075128.GB501@swordfish> MIME-Version: 1.0 In-Reply-To: <20160321075128.GB501@swordfish> User-Agent: Mutt/1.5.21 (2010-09-15) X-MIMETrack: Itemize by SMTP Server on LGEKRMHUB06/LGE/LG Group(Release 8.5.3FP6|November 21, 2013) at 2016/03/22 09:37:42, Serialize by Router on LGEKRMHUB06/LGE/LG Group(Release 8.5.3FP6|November 21, 2013) at 2016/03/22 09:37:43, Serialize complete at 2016/03/22 09:37:43 Content-Type: text/plain; charset="us-ascii" Content-Disposition: inline Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Hello Sergey, On Mon, Mar 21, 2016 at 04:51:28PM +0900, Sergey Senozhatsky wrote: > Hello Minchan, > > On (03/18/16 10:25), Minchan Kim wrote: > [..] > > > aha, ok. > > > > > > > (ie, simple code, removing > > > > max_comp_streams knob, no need to this your stat, guarantee parallel > > > > level, guarantee consumed memory space). > > > > > > I'll take a look and prepare some numbers (most likely next week). > > > > Sounds great to me! > > so I have schematically this thing now. streams are per-cpu and contain > scratch buffer and work mem. > > zram_bvec_write() > { > *get_cpu_ptr(comp->stream); > zcomp_compress(); > zs_malloc() > put_cpu_ptr(comp->stream); > } > > this, however, makes zsmalloc unhapy. pool has GFP_NOIO | __GFP_HIGHMEM > gfp, and GFP_NOIO is ___GFP_DIRECT_RECLAIM|___GFP_KSWAPD_RECLAIM. this > __GFP_DIRECT_RECLAIM is in the conflict with per-cpu streams, because > per-cpu streams require disabled preemption (up until we copy stream > buffer to zspage). so what options do we have here... from the top of > my head (w/o a lot of thinking)... Indeed. > -- remove __GFP_DIRECT_RECLAIM from pool gfp mask, which a bit is risky... > IOW, make pool gfp '___GFP_KSWAPD_RECLAIM | __GFP_HIGHMEM' Yeb. It would be okay for zram-swap but not zram-blk. > -- kmalloc/kfree temp buffer for every RW op, which is ugly... because > it sort of voids the whole purpose of per-cpu streams. How about this? zram_bvec_write() { retry: *get_cpu_ptr(comp->stream); zcomp_compress(); handle = zs_malloc((gfp &~ __GFP_DIRECT_RECLAIM| | GFP_NOWARN) if (!handle) { put_cpu_ptr(comp->stream); handle = zs_malloc(gfp); goto retry; } put_cpu_ptr(comp->stream); } If per-cpu model really performance win, it is worth to try.