Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753438AbdCOQvP (ORCPT ); Wed, 15 Mar 2017 12:51:15 -0400 Received: from mail-wr0-f174.google.com ([209.85.128.174]:33067 "EHLO mail-wr0-f174.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752504AbdCOQul (ORCPT ); Wed, 15 Mar 2017 12:50:41 -0400 To: linux-kernel@vger.kernel.org, linux-mm@kvack.org From: Avi Kivity Subject: MAP_POPULATE vs. MADV_HUGEPAGES Organization: ScyllaDB Message-ID: Date: Wed, 15 Mar 2017 18:50:32 +0200 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:45.0) Gecko/20100101 Thunderbird/45.7.0 MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 484 Lines: 12 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(). 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? Is my only option to serialize those memory allocations, and fault in those pages manually? Or perhaps use mlock()?