From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752282AbdCPMex (ORCPT ); Thu, 16 Mar 2017 08:34:53 -0400 Received: from mx2.suse.de ([195.135.220.15]:57843 "EHLO mx2.suse.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751934AbdCPMew (ORCPT ); Thu, 16 Mar 2017 08:34:52 -0400 Date: Thu, 16 Mar 2017 13:34:49 +0100 From: Michal Hocko To: Avi Kivity Cc: linux-kernel@vger.kernel.org, linux-mm@kvack.org Subject: Re: MAP_POPULATE vs. MADV_HUGEPAGES Message-ID: <20170316123449.GE30508@dhcp22.suse.cz> References: MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.5.23 (2014-03-12) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Wed 15-03-17 18:50:32, Avi Kivity wrote: > A user is trying to allocate 1TB of anonymous memory in parallel on 48 cores > (4 NUMA nodes). The kernel ends up spinning in isolate_freepages_block(). Which kernel version is that? What is the THP defrag mode (/sys/kernel/mm/transparent_hugepage/defrag)? > I thought to help it along by using MAP_POPULATE, but then my MADV_HUGEPAGE > won't be seen until after mmap() completes, with pages already populated. > Are MAP_POPULATE and MADV_HUGEPAGE mutually exclusive? Why do you need MADV_HUGEPAGE? > Is my only option to serialize those memory allocations, and fault in those > pages manually? Or perhaps use mlock()? I am still not 100% sure I see what you are trying to achieve, though. So you do not want all those processes to contend inside the compaction while still allocate as many huge pages as possible? -- Michal Hocko SUSE Labs