From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752236AbbGJCGC (ORCPT ); Thu, 9 Jul 2015 22:06:02 -0400 Received: from mail-pd0-f173.google.com ([209.85.192.173]:32878 "EHLO mail-pd0-f173.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751346AbbGJCFx (ORCPT ); Thu, 9 Jul 2015 22:05:53 -0400 Date: Fri, 10 Jul 2015 11:06:24 +0900 From: Sergey Senozhatsky To: Minchan Kim Cc: Andrew Morton , Sergey Senozhatsky , Nitin Gupta , linux-kernel@vger.kernel.org, linux-mm@kvack.org Subject: Re: [PATCH] zsmalloc: consider ZS_ALMOST_FULL as migrate source Message-ID: <20150710020624.GB692@swordfish> References: <1436491929-6617-1-git-send-email-minchan@kernel.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <1436491929-6617-1-git-send-email-minchan@kernel.org> User-Agent: Mutt/1.5.23+89 (0255b37be491) (2014-03-12) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On (07/10/15 10:32), Minchan Kim wrote: > static struct page *isolate_source_page(struct size_class *class) > { > struct page *page; > + int i; > + bool found = false; > why use 'bool found'? just return `page', which will be either NULL or !NULL? -ss > - page = class->fullness_list[ZS_ALMOST_EMPTY]; > - if (page) > - remove_zspage(page, class, ZS_ALMOST_EMPTY); > + for (i = ZS_ALMOST_EMPTY; i >= ZS_ALMOST_FULL; i--) { > + page = class->fullness_list[i]; > + if (!page) > + continue; > > - return page; > + remove_zspage(page, class, i); > + found = true; > + break; > + } > + > + return found ? page : NULL; > } -ss