Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S932679AbdIRNpn (ORCPT ); Mon, 18 Sep 2017 09:45:43 -0400 Received: from mx1.redhat.com ([209.132.183.28]:55774 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753589AbdIRNpl (ORCPT ); Mon, 18 Sep 2017 09:45:41 -0400 DMARC-Filter: OpenDMARC Filter v1.3.2 mx1.redhat.com DB5BA267DF Authentication-Results: ext-mx06.extmail.prod.ext.phx2.redhat.com; dmarc=none (p=none dis=none) header.from=redhat.com Authentication-Results: ext-mx06.extmail.prod.ext.phx2.redhat.com; spf=fail smtp.mailfrom=fweimer@redhat.com Subject: Re: [patch] mremap.2: Add description of old_size == 0 functionality To: Mike Kravetz , mtk.manpages@gmail.com Cc: linux-man@vger.kernel.org, linux-kernel@vger.kernel.org, linux-api@vger.kernel.org, Michal Hocko , Andrea Arcangeli , "Kirill A . Shutemov" , Vlastimil Babka , Anshuman Khandual , linux-mm@kvack.org References: <20170915213745.6821-1-mike.kravetz@oracle.com> From: Florian Weimer Message-ID: Date: Mon, 18 Sep 2017 15:45:37 +0200 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.3.0 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset=utf-8; format=flowed Content-Language: en-US Content-Transfer-Encoding: 7bit X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.30]); Mon, 18 Sep 2017 13:45:41 +0000 (UTC) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 1058 Lines: 26 On 09/15/2017 11:53 PM, Mike Kravetz wrote: > +If the value of \fIold_size\fP is zero, and \fIold_address\fP refers to > +a private anonymous mapping, then > +.BR mremap () > +will create a new mapping of the same pages. \fInew_size\fP > +will be the size of the new mapping and the location of the new mapping > +may be specified with \fInew_address\fP, see the description of > +.B MREMAP_FIXED > +below. If a new mapping is requested via this method, then the > +.B MREMAP_MAYMOVE > +flag must also be specified. This functionality is deprecated, and no > +new code should be written to use this feature. A better method of > +obtaining multiple mappings of the same private anonymous memory is via the > +.BR memfd_create() > +system call. Is there any particular reason to deprecate this? In glibc, we cannot use memfd_create and keep the file descriptor around because the application can close descriptors beneath us. (We might want to use alias mappings to avoid run-time code generation for PLT-less LD_AUDIT interceptors.) Thanks, Florian