Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752803AbbKYPIT (ORCPT ); Wed, 25 Nov 2015 10:08:19 -0500 Received: from mx2.suse.de ([195.135.220.15]:49429 "EHLO mx2.suse.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1750811AbbKYPIP (ORCPT ); Wed, 25 Nov 2015 10:08:15 -0500 Subject: Re: [PATCH v2 3/9] mm, page_owner: convert page_owner_inited to static key To: Michal Hocko References: <1448368581-6923-1-git-send-email-vbabka@suse.cz> <1448368581-6923-4-git-send-email-vbabka@suse.cz> <20151125145202.GL27283@dhcp22.suse.cz> Cc: linux-mm@kvack.org, linux-kernel@vger.kernel.org, Andrew Morton , Joonsoo Kim , Minchan Kim , Sasha Levin , "Kirill A. Shutemov" , Mel Gorman , Peter Zijlstra From: Vlastimil Babka X-Enigmail-Draft-Status: N1110 Message-ID: <5655CEDB.3040205@suse.cz> Date: Wed, 25 Nov 2015 16:08:11 +0100 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:38.0) Gecko/20100101 Thunderbird/38.3.0 MIME-Version: 1.0 In-Reply-To: <20151125145202.GL27283@dhcp22.suse.cz> Content-Type: text/plain; charset=windows-1252 Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 1565 Lines: 32 [+CC PeterZ] On 11/25/2015 03:52 PM, Michal Hocko wrote: > On Tue 24-11-15 13:36:15, Vlastimil Babka wrote: >> CONFIG_PAGE_OWNER attempts to impose negligible runtime overhead when enabled >> during compilation, but not actually enabled during runtime by boot param >> page_owner=on. This overhead can be further reduced using the static key >> mechanism, which this patch does. > > Is this really worth doing? Well, I assume that jump labels exist for a reason, and allocation hot paths are sufficiently sensitive to be worth it? It's not an extra maintenance burden for us anyway. Just a bit different content of the if () line. > If we do not have jump labels then the check > will be atomic rather than a simple access, so it would be more costly, > no? Or am I missing something? Well, atomic read is a simple READ_ONCE on x86_64. That excludes some compiler optimizations, but it's not expensive for the CPU. The optimization would be caching the value of the flag to a register, which would only potentially affect multiple checks from the same function (and its inlines). Which doesn't happen AFAIK, as it's just once in the allocation and once in the free path? Now I admit I have no idea if there are architectures that don't support jump labels *and* have an expensive atomic read, and whether we care? -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/