On Sun 16-05-21 10:29:24, Mike Rapoport wrote: > On Fri, May 14, 2021 at 11:25:43AM +0200, David Hildenbrand wrote: [...] > > > + if (!page) > > > + return VM_FAULT_OOM; > > > + > > > + err = set_direct_map_invalid_noflush(page, 1); > > > + if (err) { > > > + put_page(page); > > > + return vmf_error(err); > > > > Would we want to translate that to a proper VM_FAULT_..., which would most > > probably be VM_FAULT_OOM when we fail to allocate a pagetable? > > That's what vmf_error does, it translates -ESOMETHING to VM_FAULT_XYZ. I haven't read through the rest but this has just caught my attention. Is it really reasonable to trigger the oom killer when you cannot invalidate the direct mapping. From a quick look at the code it is quite unlikely to se ENOMEM from that path (it allocates small pages) but this can become quite sublte over time. Shouldn't this simply SIGBUS if it cannot manipulate the direct mapping regardless of the underlying reason for that? -- Michal Hocko SUSE Labs