From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752653AbdLNNPc (ORCPT ); Thu, 14 Dec 2017 08:15:32 -0500 Received: from mx2.suse.de ([195.135.220.15]:39084 "EHLO mx2.suse.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752296AbdLNNP3 (ORCPT ); Thu, 14 Dec 2017 08:15:29 -0500 Date: Thu, 14 Dec 2017 14:15:26 +0100 From: Michal Hocko To: Edward Napierala Cc: Andrew Morton , linux-api@vger.kernel.org, Khalid Aziz , Michael Ellerman , Russell King - ARM Linux , Andrea Arcangeli , linux-mm@kvack.org, LKML , linux-arch@vger.kernel.org, Florian Weimer , John Hubbard , Matthew Wilcox , Abdul Haleem , Joel Stanley , Kees Cook , jasone@google.com, davidtgoldblatt@gmail.com Subject: Re: [PATCH v2 0/2] mm: introduce MAP_FIXED_SAFE Message-ID: <20171214131526.GM16951@dhcp22.suse.cz> References: <20171213092550.2774-1-mhocko@kernel.org> <20171213163210.6a16ccf8753b74a6982ef5b6@linux-foundation.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.9.1 (2017-09-22) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Thu 14-12-17 12:44:17, Edward Napierala wrote: > Regarding the name - how about adopting MAP_EXCL? It was introduced in > FreeBSD, > and seems to do exactly this; quoting mmap(2): > > MAP_FIXED Do not permit the system to select a different address > than the one specified. If the specified address > cannot be used, mmap() will fail. If MAP_FIXED is > specified, addr must be a multiple of the page size. > If MAP_EXCL is not specified, a successful MAP_FIXED > request replaces any previous mappings for the > process' pages in the range from addr to addr + len. > In contrast, if MAP_EXCL is specified, the request > will fail if a mapping already exists within the > range. I am not familiar with the FreeBSD implementation but from the above it looks like MAP_EXCL is a MAP_FIXED mofifier which is not how we are going to implement it in linux due to reasons mentioned in this cover letter. Using the same name would be more confusing than helpful I am afraid. -- Michal Hocko SUSE Labs From mboxrd@z Thu Jan 1 00:00:00 1970 From: Michal Hocko Subject: Re: [PATCH v2 0/2] mm: introduce MAP_FIXED_SAFE Date: Thu, 14 Dec 2017 14:15:26 +0100 Message-ID: <20171214131526.GM16951@dhcp22.suse.cz> References: <20171213092550.2774-1-mhocko@kernel.org> <20171213163210.6a16ccf8753b74a6982ef5b6@linux-foundation.org> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Return-path: Content-Disposition: inline In-Reply-To: Sender: owner-linux-mm@kvack.org To: Edward Napierala Cc: Andrew Morton , linux-api@vger.kernel.org, Khalid Aziz , Michael Ellerman , Russell King - ARM Linux , Andrea Arcangeli , linux-mm@kvack.org, LKML , linux-arch@vger.kernel.org, Florian Weimer , John Hubbard , Matthew Wilcox , Abdul Haleem , Joel Stanley , Kees Cook , jasone@google.com, davidtgoldblatt@gmail.com List-Id: linux-api@vger.kernel.org On Thu 14-12-17 12:44:17, Edward Napierala wrote: > Regarding the name - how about adopting MAP_EXCL? It was introduced in > FreeBSD, > and seems to do exactly this; quoting mmap(2): > > MAP_FIXED Do not permit the system to select a different address > than the one specified. If the specified address > cannot be used, mmap() will fail. If MAP_FIXED is > specified, addr must be a multiple of the page size. > If MAP_EXCL is not specified, a successful MAP_FIXED > request replaces any previous mappings for the > process' pages in the range from addr to addr + len. > In contrast, if MAP_EXCL is specified, the request > will fail if a mapping already exists within the > range. I am not familiar with the FreeBSD implementation but from the above it looks like MAP_EXCL is a MAP_FIXED mofifier which is not how we are going to implement it in linux due to reasons mentioned in this cover letter. Using the same name would be more confusing than helpful I am afraid. -- Michal Hocko SUSE Labs -- To unsubscribe, send a message with 'unsubscribe linux-mm' in the body to majordomo@kvack.org. For more info on Linux MM, see: http://www.linux-mm.org/ . Don't email: email@kvack.org