[lkml]   [2017]   [Nov]   [20]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
Messages in this thread
SubjectRe: [RFC PATCH 1/2] mm: introduce MAP_FIXED_SAFE
On Fri 17-11-17 08:30:48, Florian Weimer wrote:
> On 11/16/2017 11:18 AM, Michal Hocko wrote:
> > + if (flags & MAP_FIXED_SAFE) {
> > + struct vm_area_struct *vma = find_vma(mm, addr);
> > +
> > + if (vma && vma->vm_start <= addr)
> > + return -ENOMEM;
> > + }
> Could you pick a different error code which cannot also be caused by a an
> unrelated, possibly temporary condition? Maybe EBUSY or EEXIST?

Hmm, none of those are described in the man page. I am usually very
careful to not add new and potentially unexpected error codes but it is
true that a new flag should warrant a new error code. I am not sure
which one is more appropriate though. EBUSY suggests that retrying might
help which is true only if some other party unmaps the range. So EEXIST
would sound more natural.

> This would definitely help with application-based randomization of mappings,
> and there, actual ENOMEM and this error would have to be handled
> differently.

I see. Could you be more specific about the usecase you have in mind? I
would incorporate it into the patch description.
Michal Hocko

 \ /
  Last update: 2017-11-20 09:55    [W:0.101 / U:0.276 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site