From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753028AbdI0JDG (ORCPT ); Wed, 27 Sep 2017 05:03:06 -0400 Received: from resqmta-ch2-07v.sys.comcast.net ([69.252.207.39]:43624 "EHLO resqmta-ch2-07v.sys.comcast.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753001AbdI0JDD (ORCPT ); Wed, 27 Sep 2017 05:03:03 -0400 Date: Wed, 27 Sep 2017 04:03:01 -0500 (CDT) From: Christopher Lameter X-X-Sender: cl@nuc-kabylake To: Michal Hocko cc: Johannes Thumshirn , Pekka Enberg , David Rientjes , Joonsoo Kim , Andrew Morton , linux-mm@kvack.org, linux-kernel@vger.kernel.org, Damien Le Moal , Christoph Hellwig Subject: Re: [PATCH 1/6] mm: add kmalloc_array_node and kcalloc_node In-Reply-To: <20170927084251.kxves5ce76jz5skr@dhcp22.suse.cz> Message-ID: References: <20170927082038.3782-1-jthumshirn@suse.de> <20170927082038.3782-2-jthumshirn@suse.de> <20170927084251.kxves5ce76jz5skr@dhcp22.suse.cz> User-Agent: Alpine 2.20 (DEB 67 2015-01-07) MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII X-CMAE-Envelope: MS4wfCgf+GWDdCl71nu670JMkm7W5QFxJKdd0ZEoktRWdFrhA44nttkw3iP18yLGEWWuBCwZLoWUlKpSrFGXJKVAWyiKusdU61M0jefer4mU+qOLeFuyic/u GgRm1qQ6meNZnqWVfM0aGXLkj9TxCpGNYkcdqpOT/TZTMDTZ9QFwbpkryL1mZOoLqWCP8GA2fgAUTlbqGNs4tsklhwla/wHYN1otZ34kDx1h6rdXLaWA3c5+ Z1uajzg8CLAu6ih/7DhdNHQzuXTIoR7r+rnwOuqhTn3ElRnrz/SzQqbMw3P9MNMiq6os3l816DDxaNdvz9rewf0d4FYxwvzwHFjUC6ZLJ0mcXN9R/a0ApTmx iAUV1dGXxwIkotKtMUN0HQjP+1KxXlzgcbZNhdBr5VguylbxEs2jz6OeY9CdHJ+K142CZzLjvq9zfzPXP8iki5byzfUX1Q== Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Wed, 27 Sep 2017, Michal Hocko wrote: > > Introduce a combination of the two above cases to have a NUMA-node aware > > version of kmalloc_array() and kcalloc(). > > Yes, this is helpful. I am just wondering why we cannot have > kmalloc_array to call kmalloc_array_node with the local node as a > parameter. Maybe some sort of an optimization? Well the regular kmalloc without node is supposed to follow memory policies. An explicit mentioning of a node requires allocation from that node and will override memory allocation policies. Note that node local policy is the default for allocations but that can be overridden by the application or at the command line level. Assumptions that this is always the case come up frequently but if we do that we will loose the ability to control memory locality for user space.