From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752638AbcCUHvO (ORCPT ); Mon, 21 Mar 2016 03:51:14 -0400 Received: from mail-pf0-f193.google.com ([209.85.192.193]:35400 "EHLO mail-pf0-f193.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752706AbcCUHvL (ORCPT ); Mon, 21 Mar 2016 03:51:11 -0400 Date: Mon, 21 Mar 2016 16:51:28 +0900 From: Sergey Senozhatsky To: Minchan Kim Cc: Sergey Senozhatsky , Sergey Senozhatsky , Andrew Morton , linux-kernel@vger.kernel.org Subject: Re: [PATCH] zram: export the number of available comp streams Message-ID: <20160321075128.GB501@swordfish> 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> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20160318012524.GA10612@bbox> User-Agent: Mutt/1.5.24 (2015-08-30) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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)... -- remove __GFP_DIRECT_RECLAIM from pool gfp mask, which a bit is risky... IOW, make pool gfp '___GFP_KSWAPD_RECLAIM | __GFP_HIGHMEM' -- kmalloc/kfree temp buffer for every RW op, which is ugly... because it sort of voids the whole purpose of per-cpu streams. -- ... hm. -ss