From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1757938AbdAIJ6h (ORCPT ); Mon, 9 Jan 2017 04:58:37 -0500 Received: from mx2.suse.de ([195.135.220.15]:42945 "EHLO mx2.suse.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753010AbdAIJ6b (ORCPT ); Mon, 9 Jan 2017 04:58:31 -0500 Date: Mon, 9 Jan 2017 10:58:28 +0100 From: Michal Hocko To: Eric Dumazet Cc: Eric Dumazet , Tom Herbert , linux-mm@kvack.org, LKML Subject: Re: weird allocation pattern in alloc_ila_locks Message-ID: <20170109095828.GE7495@dhcp22.suse.cz> References: <20170106095115.GG5556@dhcp22.suse.cz> <20170106100433.GH5556@dhcp22.suse.cz> <20170106121642.GJ5556@dhcp22.suse.cz> <1483740889.9712.44.camel@edumazet-glaptop3.roam.corp.google.com> <20170107092746.GC5047@dhcp22.suse.cz> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.6.0 (2016-04-01) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Sat 07-01-17 10:37:41, Eric Dumazet wrote: > On Sat, Jan 7, 2017 at 1:27 AM, Michal Hocko wrote: > > On Fri 06-01-17 14:14:49, Eric Dumazet wrote: > > >> I believe the intent was to get NUMA spreading, a bit like what we have > >> in alloc_large_system_hash() when hashdist == HASHDIST_DEFAULT > > > > Hmm, I am not sure this works as expected then. Because it is more > > likely that all pages backing the vmallocked area will come from the > > local node than spread around more nodes. Or did I miss your point? > > Well, you missed that vmalloc() is aware of NUMA policies. You are right. I have missed that alloc_page ends up using alloc_pages_current for CONFIG_NUMA rather than alloc_pages_node. > If current process has requested interleave on 2 nodes (as it is done > at boot time on a dual node system), > then vmalloc() of 8 pages will allocate 4 pages on each node. On the other hand alloc_ila_locks does go over a single page when lockdep is enabled and I am wondering whether doing this NUMA subtle magic is any win... Also this seems to be an init code so I assume a modprobe would have to set a non-default policy to make use of it. Does anybody do that out there? alloc_bucket_locks is a bit more complicated because it is not only called from the init context. But considering that rhashtable_shrink is called from the worker context - so no mem policy can be assumed then I am wondering whether the code really works as expected. To me it sounds like it is trying to be clever while the outcome doesn't really do what it is intended. Would you mind if I just convert it to kvmalloc and make it easier to understand? -- Michal Hocko SUSE Labs