From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S934454AbdJQRqK (ORCPT ); Tue, 17 Oct 2017 13:46:10 -0400 Received: from mx2.suse.de ([195.135.220.15]:44941 "EHLO mx2.suse.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753905AbdJQRqF (ORCPT ); Tue, 17 Oct 2017 13:46:05 -0400 Subject: Re: [RFC PATCH 3/3] mm/map_contig: Add mmap(MAP_CONTIG) support To: Guy Shattah , Michal Nazarewicz , Michal Hocko Cc: Christopher Lameter , Mike Kravetz , "linux-mm@kvack.org" , "linux-kernel@vger.kernel.org" , "linux-api@vger.kernel.org" , Marek Szyprowski , "Aneesh Kumar K . V" , Joonsoo Kim , Anshuman Khandual , Laura Abbott References: <20171013084054.me3kxhgbxzgm2lpr@dhcp22.suse.cz> <20171013152801.nbpk6nluotgbmfrs@dhcp22.suse.cz> <20171013154747.2jv7rtfqyyagiodn@dhcp22.suse.cz> <20171013161736.htumyr4cskfrjq64@dhcp22.suse.cz> <752b49eb-55c6-5a34-ab41-6e91dd93ea70@mellanox.com> <20171016082456.no6ux63uy2rmj4fe@dhcp22.suse.cz> <0e238c56-c59d-f648-95fc-c8cb56c3652e@mellanox.com> <20171016123248.csntl6luxgafst6q@dhcp22.suse.cz> From: Vlastimil Babka Message-ID: <32726f82-e044-25e3-fdbf-ba3630da5053@suse.cz> Date: Tue, 17 Oct 2017 19:44:44 +0200 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: Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 10/17/2017 04:20 PM, Guy Shattah wrote: > > >> On Tue, Oct 17 2017, Guy Shattah wrote: >>> Are you going to be OK with kernel API which implements contiguous >>> memory allocation? Possibly with mmap style? Many drivers could >>> utilize it instead of having their own weird and possibly non-standard >>> way to allocate contiguous memory. Such API won't be available for >>> user space. >> >> What you describe sounds like CMA. It may be far from perfect but it’s there >> already and drivers which need contiguous memory can allocate it. >> > > 1. CMA has to preconfigured. We're suggesting mechanism that works 'out of the box' > 2. Due to the pre-allocation techniques CMA imposes limitation on maximum > allocated memory. RDMA users often require 1Gb or more, sometimes more. > 3. CMA reserves memory in advance, our suggestion is using existing kernel memory > mechanisms (THP for example) to allocate memory. You can already use THP, right? madvise(MADV_HUGEPAGE) increases your chances to get the huge pages. Then you can mlock() them if you want. And you get the TLB benefits. There's no guarantee of course, but you shouldn't require a guarantee for MMAP_CONTIG anyway, because it's for performance reasons, not functionality. So either MMAP_CONTIG would have to fallback itself, or the userspace caller. Or would your scenario rather fail than perform suboptimally? > Guy > >