From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S933645AbaFLL4c (ORCPT ); Thu, 12 Jun 2014 07:56:32 -0400 Received: from cantor2.suse.de ([195.135.220.15]:52097 "EHLO mx2.suse.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S933546AbaFLL4Y (ORCPT ); Thu, 12 Jun 2014 07:56:24 -0400 Message-ID: <53999563.9060105@suse.cz> Date: Thu, 12 Jun 2014 13:56:19 +0200 From: Vlastimil Babka User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:24.0) Gecko/20100101 Thunderbird/24.5.0 MIME-Version: 1.0 To: David Rientjes CC: linux-mm@kvack.org, linux-kernel@vger.kernel.org, Andrew Morton , Greg Thelen , Minchan Kim , Mel Gorman , Joonsoo Kim , Michal Nazarewicz , Naoya Horiguchi , Christoph Lameter , Rik van Riel Subject: Re: [RFC PATCH 4/6] mm, compaction: skip buddy pages by their order in the migrate scanner References: <1401898310-14525-1-git-send-email-vbabka@suse.cz> <1401898310-14525-4-git-send-email-vbabka@suse.cz> <5390374E.5080708@suse.cz> <53916BB0.3070001@suse.cz> <53959C11.2000305@suse.cz> <5396B31B.6080706@suse.cz> <5398492E.3070406@suse.cz> In-Reply-To: Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 06/12/2014 02:21 AM, David Rientjes wrote: > On Wed, 11 Jun 2014, Vlastimil Babka wrote: > >>> I hate to belabor this point, but I think gcc does treat it differently. >>> If you look at the assembly comparing your patch to if you do >>> >>> unsigned long freepage_order = ACCESS_ONCE(page_private(page)); >>> >>> instead, then if you enable annotation you'll see that gcc treats the >>> store as page_x->D.y.private in your patch vs. MEM[(volatile long unsigned >>> int *)page_x + 48B] with the above. >> >> Hm sure you compiled a version that used page_order_unsafe() and not >> page_order()? Because I do see: >> >> MEM[(volatile long unsigned int *)valid_page_114 + 48B]; >> >> That's gcc 4.8.1, but our gcc guy said he tried 4.5+ and all was like this. >> And that it would be a gcc bug if not. >> He also did a test where page_order was called twice in one function and >> page_order_unsafe twice in another function. page_order() was reduced to a >> single access in the assembly, page_order_unsafe were two accesses. >> > > Ok, and I won't continue to push the point. I'd rather know I'm correct and not just persistent enough :) If you confirm that your compiler behaves differently, then maybe making page_order_unsafe a #define instead of inline function would prevent this issue? > I think the lockless > suitable_migration_target() call that looks at page_order() is fine in the > free scanner since we use it as a racy check, but it might benefit from > either a comment describing the behavior or a sanity check for > page_order(page) <= MAX_ORDER as you've done before. OK, I'll add that. From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-wi0-f175.google.com (mail-wi0-f175.google.com [209.85.212.175]) by kanga.kvack.org (Postfix) with ESMTP id 7F8D16B00E0 for ; Thu, 12 Jun 2014 07:56:24 -0400 (EDT) Received: by mail-wi0-f175.google.com with SMTP id r20so1477656wiv.2 for ; Thu, 12 Jun 2014 04:56:23 -0700 (PDT) Received: from mx2.suse.de (cantor2.suse.de. [195.135.220.15]) by mx.google.com with ESMTPS id k3si1386342wja.3.2014.06.12.04.56.22 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Thu, 12 Jun 2014 04:56:23 -0700 (PDT) Message-ID: <53999563.9060105@suse.cz> Date: Thu, 12 Jun 2014 13:56:19 +0200 From: Vlastimil Babka MIME-Version: 1.0 Subject: Re: [RFC PATCH 4/6] mm, compaction: skip buddy pages by their order in the migrate scanner References: <1401898310-14525-1-git-send-email-vbabka@suse.cz> <1401898310-14525-4-git-send-email-vbabka@suse.cz> <5390374E.5080708@suse.cz> <53916BB0.3070001@suse.cz> <53959C11.2000305@suse.cz> <5396B31B.6080706@suse.cz> <5398492E.3070406@suse.cz> In-Reply-To: Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit Sender: owner-linux-mm@kvack.org List-ID: To: David Rientjes Cc: linux-mm@kvack.org, linux-kernel@vger.kernel.org, Andrew Morton , Greg Thelen , Minchan Kim , Mel Gorman , Joonsoo Kim , Michal Nazarewicz , Naoya Horiguchi , Christoph Lameter , Rik van Riel On 06/12/2014 02:21 AM, David Rientjes wrote: > On Wed, 11 Jun 2014, Vlastimil Babka wrote: > >>> I hate to belabor this point, but I think gcc does treat it differently. >>> If you look at the assembly comparing your patch to if you do >>> >>> unsigned long freepage_order = ACCESS_ONCE(page_private(page)); >>> >>> instead, then if you enable annotation you'll see that gcc treats the >>> store as page_x->D.y.private in your patch vs. MEM[(volatile long unsigned >>> int *)page_x + 48B] with the above. >> >> Hm sure you compiled a version that used page_order_unsafe() and not >> page_order()? Because I do see: >> >> MEM[(volatile long unsigned int *)valid_page_114 + 48B]; >> >> That's gcc 4.8.1, but our gcc guy said he tried 4.5+ and all was like this. >> And that it would be a gcc bug if not. >> He also did a test where page_order was called twice in one function and >> page_order_unsafe twice in another function. page_order() was reduced to a >> single access in the assembly, page_order_unsafe were two accesses. >> > > Ok, and I won't continue to push the point. I'd rather know I'm correct and not just persistent enough :) If you confirm that your compiler behaves differently, then maybe making page_order_unsafe a #define instead of inline function would prevent this issue? > I think the lockless > suitable_migration_target() call that looks at page_order() is fine in the > free scanner since we use it as a racy check, but it might benefit from > either a comment describing the behavior or a sanity check for > page_order(page) <= MAX_ORDER as you've done before. OK, I'll add that. -- 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