From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752580AbaEGVod (ORCPT ); Wed, 7 May 2014 17:44:33 -0400 Received: from mail-pa0-f46.google.com ([209.85.220.46]:63380 "EHLO mail-pa0-f46.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751992AbaEGVoa (ORCPT ); Wed, 7 May 2014 17:44:30 -0400 Date: Wed, 7 May 2014 14:44:28 -0700 (PDT) From: David Rientjes X-X-Sender: rientjes@chino.kir.corp.google.com To: Vlastimil Babka cc: Andrew Morton , Hugh Dickins , Greg Thelen , linux-kernel@vger.kernel.org, linux-mm@kvack.org, Minchan Kim , Mel Gorman , Joonsoo Kim , Bartlomiej Zolnierkiewicz , Michal Nazarewicz , Christoph Lameter , Rik van Riel Subject: Re: [PATCH v2 1/2] mm/compaction: do not count migratepages when unnecessary In-Reply-To: <1399464550-26447-1-git-send-email-vbabka@suse.cz> Message-ID: References: <1399464550-26447-1-git-send-email-vbabka@suse.cz> User-Agent: Alpine 2.02 (DEB 1266 2009-07-14) MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Wed, 7 May 2014, Vlastimil Babka wrote: > During compaction, update_nr_listpages() has been used to count remaining > non-migrated and free pages after a call to migrage_pages(). The freepages > counting has become unneccessary, and it turns out that migratepages counting > is also unnecessary in most cases. > > The only situation when it's needed to count cc->migratepages is when > migrate_pages() returns with a negative error code. Otherwise, the non-negative > return value is the number of pages that were not migrated, which is exactly > the count of remaining pages in the cc->migratepages list. > > Furthermore, any non-zero count is only interesting for the tracepoint of > mm_compaction_migratepages events, because after that all remaining unmigrated > pages are put back and their count is set to 0. > > This patch therefore removes update_nr_listpages() completely, and changes the > tracepoint definition so that the manual counting is done only when the > tracepoint is enabled, and only when migrate_pages() returns a negative error > code. > > Furthermore, migrate_pages() and the tracepoints won't be called when there's > nothing to migrate. This potentially avoids some wasted cycles and reduces the > volume of uninteresting mm_compaction_migratepages events where "nr_migrated=0 > nr_failed=0". In the stress-highalloc mmtest, this was about 75% of the events. > The mm_compaction_isolate_migratepages event is better for determining that > nothing was isolated for migration, and this one was just duplicating the info. > > Signed-off-by: Vlastimil Babka > Reviewed-by: Naoya Horiguchi > Cc: Minchan Kim > Cc: Mel Gorman > Cc: Joonsoo Kim > Cc: Bartlomiej Zolnierkiewicz > Cc: Michal Nazarewicz > Cc: Christoph Lameter > Cc: Rik van Riel Acked-by: David Rientjes I like this, before our two patches update_nr_listpages() was expensive when called for each pageblock and being able to remove it is certainly a step in the right direction to make compaction as fast as possible. From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-pa0-f46.google.com (mail-pa0-f46.google.com [209.85.220.46]) by kanga.kvack.org (Postfix) with ESMTP id AD8DE6B0078 for ; Wed, 7 May 2014 17:44:31 -0400 (EDT) Received: by mail-pa0-f46.google.com with SMTP id kx10so1737720pab.33 for ; Wed, 07 May 2014 14:44:31 -0700 (PDT) Received: from mail-pa0-x22c.google.com (mail-pa0-x22c.google.com [2607:f8b0:400e:c03::22c]) by mx.google.com with ESMTPS id fd9si14451321pad.224.2014.05.07.14.44.30 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Wed, 07 May 2014 14:44:30 -0700 (PDT) Received: by mail-pa0-f44.google.com with SMTP id ld10so1710934pab.31 for ; Wed, 07 May 2014 14:44:30 -0700 (PDT) Date: Wed, 7 May 2014 14:44:28 -0700 (PDT) From: David Rientjes Subject: Re: [PATCH v2 1/2] mm/compaction: do not count migratepages when unnecessary In-Reply-To: <1399464550-26447-1-git-send-email-vbabka@suse.cz> Message-ID: References: <1399464550-26447-1-git-send-email-vbabka@suse.cz> MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII Sender: owner-linux-mm@kvack.org List-ID: To: Vlastimil Babka Cc: Andrew Morton , Hugh Dickins , Greg Thelen , linux-kernel@vger.kernel.org, linux-mm@kvack.org, Minchan Kim , Mel Gorman , Joonsoo Kim , Bartlomiej Zolnierkiewicz , Michal Nazarewicz , Christoph Lameter , Rik van Riel On Wed, 7 May 2014, Vlastimil Babka wrote: > During compaction, update_nr_listpages() has been used to count remaining > non-migrated and free pages after a call to migrage_pages(). The freepages > counting has become unneccessary, and it turns out that migratepages counting > is also unnecessary in most cases. > > The only situation when it's needed to count cc->migratepages is when > migrate_pages() returns with a negative error code. Otherwise, the non-negative > return value is the number of pages that were not migrated, which is exactly > the count of remaining pages in the cc->migratepages list. > > Furthermore, any non-zero count is only interesting for the tracepoint of > mm_compaction_migratepages events, because after that all remaining unmigrated > pages are put back and their count is set to 0. > > This patch therefore removes update_nr_listpages() completely, and changes the > tracepoint definition so that the manual counting is done only when the > tracepoint is enabled, and only when migrate_pages() returns a negative error > code. > > Furthermore, migrate_pages() and the tracepoints won't be called when there's > nothing to migrate. This potentially avoids some wasted cycles and reduces the > volume of uninteresting mm_compaction_migratepages events where "nr_migrated=0 > nr_failed=0". In the stress-highalloc mmtest, this was about 75% of the events. > The mm_compaction_isolate_migratepages event is better for determining that > nothing was isolated for migration, and this one was just duplicating the info. > > Signed-off-by: Vlastimil Babka > Reviewed-by: Naoya Horiguchi > Cc: Minchan Kim > Cc: Mel Gorman > Cc: Joonsoo Kim > Cc: Bartlomiej Zolnierkiewicz > Cc: Michal Nazarewicz > Cc: Christoph Lameter > Cc: Rik van Riel Acked-by: David Rientjes I like this, before our two patches update_nr_listpages() was expensive when called for each pageblock and being able to remove it is certainly a step in the right direction to make compaction as fast as possible. -- To unsubscribe, send a message with 'unsubscribe linux-mm' in the body to majordomo@kvack.org. For more info on Linux MM, see: http://www.linux-mm.org/ . Don't email: email@kvack.org