From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751097AbdEBFCd (ORCPT ); Tue, 2 May 2017 01:02:33 -0400 Received: from LGEAMRELO13.lge.com ([156.147.23.53]:48007 "EHLO lgeamrelo13.lge.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1750713AbdEBFCb (ORCPT ); Tue, 2 May 2017 01:02:31 -0400 X-Original-SENDERIP: 156.147.1.126 X-Original-MAILFROM: minchan@kernel.org X-Original-SENDERIP: 10.177.223.161 X-Original-MAILFROM: minchan@kernel.org Date: Tue, 2 May 2017 14:02:28 +0900 From: Minchan Kim To: "Huang, Ying" Cc: Andrew Morton , linux-mm@kvack.org, linux-kernel@vger.kernel.org, Hugh Dickins , Shaohua Li , Rik van Riel Subject: Re: [PATCH -mm -v3] mm, swap: Sort swap entries before free Message-ID: <20170502050228.GA27176@bbox> References: <87tw5idjv9.fsf@yhuang-dev.intel.com> <20170424045213.GA11287@bbox> <87y3un2vdp.fsf@yhuang-dev.intel.com> <20170427043545.GA1726@bbox> <87r30dz6am.fsf@yhuang-dev.intel.com> <20170428074257.GA19510@bbox> <871ssdvtx5.fsf@yhuang-dev.intel.com> <20170428090049.GA26460@bbox> <87h918vjlr.fsf@yhuang-dev.intel.com> <878tmkvemu.fsf@yhuang-dev.intel.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <878tmkvemu.fsf@yhuang-dev.intel.com> 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 On Fri, Apr 28, 2017 at 09:35:37PM +0800, Huang, Ying wrote: > In fact, during the test, I found the overhead of sort() is comparable > with the performance difference of adding likely()/unlikely() to the > "if" in the function. Huang, This discussion is started from your optimization code: if (nr_swapfiles > 1) sort(); I don't have such fast machine so cannot test it. However, you added such optimization code in there so I guess it's *worth* to review so with spending my time, I pointed out what you are missing and suggested a idea to find a compromise. Now you are saying sort is so fast so no worth to add more logics to avoid the overhead? Then, please just drop that if condition part and instead, sort it unconditionally.