From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752597AbdK2TJh (ORCPT ); Wed, 29 Nov 2017 14:09:37 -0500 Received: from aserp1040.oracle.com ([141.146.126.69]:51526 "EHLO aserp1040.oracle.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752481AbdK2TJe (ORCPT ); Wed, 29 Nov 2017 14:09:34 -0500 Subject: Re: [PATCH RFC 1/2] mm, hugetlb: unify core page allocation accounting and initialization To: Michal Hocko Cc: linux-mm@kvack.org, Naoya Horiguchi , LKML References: <20171128101907.jtjthykeuefxu7gl@dhcp22.suse.cz> <20171128141211.11117-1-mhocko@kernel.org> <20171128141211.11117-2-mhocko@kernel.org> <4c919c6d-2e97-b66d-f572-439bb9f0587b@oracle.com> <20171129065732.lm4yucdnaizr2mjb@dhcp22.suse.cz> From: Mike Kravetz Message-ID: Date: Wed, 29 Nov 2017 11:09:26 -0800 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.4.0 MIME-Version: 1.0 In-Reply-To: <20171129065732.lm4yucdnaizr2mjb@dhcp22.suse.cz> Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: 7bit X-Source-IP: aserv0021.oracle.com [141.146.126.233] Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 11/28/2017 10:57 PM, Michal Hocko wrote: > On Tue 28-11-17 13:34:53, Mike Kravetz wrote: >> On 11/28/2017 06:12 AM, Michal Hocko wrote: > [...] >>> +/* >>> + * Allocates a fresh page to the hugetlb allocator pool in the node interleaved >>> + * manner. >>> + */ >>> static int alloc_fresh_huge_page(struct hstate *h, nodemask_t *nodes_allowed) >>> { >>> struct page *page; >>> int nr_nodes, node; >>> - int ret = 0; >>> + gfp_t gfp_mask = htlb_alloc_mask(h) | __GFP_THISNODE; >>> >>> for_each_node_mask_to_alloc(h, nr_nodes, node, nodes_allowed) { >>> - page = alloc_fresh_huge_page_node(h, node); >>> - if (page) { >>> - ret = 1; >>> + page = __hugetlb_alloc_buddy_huge_page(h, gfp_mask, >>> + node, nodes_allowed); >> >> I don't have the greatest understanding of node/nodemasks, but ... >> Since __hugetlb_alloc_buddy_huge_page calls __alloc_pages_nodemask(), do >> we still need to explicitly iterate over nodes with >> for_each_node_mask_to_alloc() here? > > Yes we do, because callers depend on the round robin allocation policy > which is implemented by the ugly for_each_node_mask_to_alloc. I am not > saying I like the way this is done but this is user visible thing. Ah, thanks. I missed the __GFP_THISNODE. Because of that, the nodes_allowed mask is not used in the allocation attempts. So, cycling through the nodes with the for_each_node_mask_to_alloc makes sense. > Or maybe I've missunderstood the whole thing... No, this should preserve the original behavior. -- Mike Kravetz