Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1705556

Re: [RFC] Tagging of vmalloc pages for supporting the pmalloc allocator

From Igor Stoppa <igor.stoppa@huawei.com>
Newsgroups linux.kernel
Subject Re: [RFC] Tagging of vmalloc pages for supporting the pmalloc allocator
Date 2017-08-07 16:20 +0200
Message-ID <ubR2W-W5-27@gated-at.bofh.it> (permalink)
References (6 earlier) <uaq4P-1Mc-31@gated-at.bofh.it> <uaFQd-4tx-5@gated-at.bofh.it> <uaFZU-4wN-1@gated-at.bofh.it> <ubOoq-7yj-7@gated-at.bofh.it> <ubQqd-nB-9@gated-at.bofh.it>
Organization linux.* mail to news gateway

Show all headers | View raw



On 07/08/17 16:31, Jerome Glisse wrote:
> On Mon, Aug 07, 2017 at 02:26:21PM +0300, Igor Stoppa wrote:

[...]

>> I'll add a vm_area field as you advised.
>>
>> Is this something I could send as standalone patch?
> 
> Note that vmalloc() is not the only thing that use vmalloc address
> space. There is also vmap() and i know one set of drivers that use
> vmap() and also use the mapping field of struct page namely GPU
> drivers.

Ah, yes, you mentioned this.

> So like i said previously i would store a flag inside vm_struct to
> know if page you are looking at are pmalloc or not.

And I was planning to follow your advice, using one of the flags.
But ...

> Again do you
> need to store something per page ? Would storing it per vm_struct
> not be enough ?

... there was this further comment, about speeding up the access to
vm_area, which seemed good from performance perspective.

---8<--------------8<--------------8<--------------8<--------------8<---
On 03/08/17 14:48, Michal Hocko wrote:
> On Thu 03-08-17 13:11:45, Igor Stoppa wrote:

[...]

>> But, to reply more specifically to your advice, yes, I think I could
>> add a flag to vm_struct and then retrieve its value, for the address
>> being processed, by passing through find_vm_area().
>
> ... and you can store vm_struct pointer to the struct page there and
> you won't need to do the slow find_vm_area. I haven't checked very
> closely but this should be possible in principle. I guess other
> callers might benefit from this as well.
---8<--------------8<--------------8<--------------8<--------------8<---

I do not strictly need to modify the page struct, but it seems it might
harm performance, if it is added on the path of hardened usercopy.

I have an updated version of the old proposal:

* put a magic number in the private field, during initialization of
pmalloc pages

* during hardened usercopy verification, when I have to assess if a page
is of pmalloc type, compare the private field against the magic number

* if and only if the private field matches the magic number, then invoke
find_vm_area(), so that the slowness affects only a possibly limited
amount of false positives.


--
igor

Back to linux.kernel | Previous | NextPrevious in thread | Next in thread | Find similar | Unroll thread


Thread

[RFC] Tagging of vmalloc pages for supporting the pmalloc allocator Igor Stoppa <igor.stoppa@huawei.com> - 2017-08-02 17:20 +0200
  Re: [RFC] Tagging of vmalloc pages for supporting the pmalloc  allocator Jerome Glisse <jglisse@redhat.com> - 2017-08-02 19:20 +0200
    Re: [RFC] Tagging of vmalloc pages for supporting the pmalloc  allocator Igor Stoppa <igor.stoppa@huawei.com> - 2017-08-03 12:20 +0200
      Re: [RFC] Tagging of vmalloc pages for supporting the pmalloc  allocator Michal Hocko <mhocko@kernel.org> - 2017-08-03 13:50 +0200
        Re: [RFC] Tagging of vmalloc pages for supporting the pmalloc  allocator Igor Stoppa <igor.stoppa@huawei.com> - 2017-08-03 14:30 +0200
          Re: [RFC] Tagging of vmalloc pages for supporting the pmalloc  allocator Michal Hocko <mhocko@kernel.org> - 2017-08-03 16:00 +0200
            Re: [RFC] Tagging of vmalloc pages for supporting the pmalloc  allocator Jerome Glisse <jglisse@redhat.com> - 2017-08-03 16:50 +0200
              Re: [RFC] Tagging of vmalloc pages for supporting the pmalloc  allocator Igor Stoppa <igor.stoppa@huawei.com> - 2017-08-03 17:10 +0200
                Re: [RFC] Tagging of vmalloc pages for supporting the pmalloc  allocator Michal Hocko <mhocko@kernel.org> - 2017-08-03 17:20 +0200
                Re: [RFC] Tagging of vmalloc pages for supporting the pmalloc  allocator Igor Stoppa <igor.stoppa@huawei.com> - 2017-08-04 10:10 +0200
                Re: [RFC] Tagging of vmalloc pages for supporting the pmalloc  allocator Michal Hocko <mhocko@kernel.org> - 2017-08-04 10:20 +0200
                Re: [RFC] Tagging of vmalloc pages for supporting the pmalloc  allocator Igor Stoppa <igor.stoppa@huawei.com> - 2017-08-07 13:30 +0200
                Re: [RFC] Tagging of vmalloc pages for supporting the pmalloc  allocator Michal Hocko <mhocko@kernel.org> - 2017-08-07 13:40 +0200
                Re: [RFC] Tagging of vmalloc pages for supporting the pmalloc  allocator Jerome Glisse <jglisse@redhat.com> - 2017-08-07 15:40 +0200
                Re: [RFC] Tagging of vmalloc pages for supporting the pmalloc  allocator Igor Stoppa <igor.stoppa@huawei.com> - 2017-08-07 16:20 +0200
                Re: [RFC] Tagging of vmalloc pages for supporting the pmalloc  allocator Jerome Glisse <jglisse@redhat.com> - 2017-08-07 21:20 +0200
                Re: [RFC] Tagging of vmalloc pages for supporting the pmalloc  allocator Igor Stoppa <igor.stoppa@huawei.com> - 2017-08-08 15:10 +0200
                Re: [RFC] Tagging of vmalloc pages for supporting the pmalloc  allocator Jerome Glisse <jglisse@redhat.com> - 2017-08-09 01:20 +0200
                Re: [RFC] Tagging of vmalloc pages for supporting the pmalloc  allocator Igor Stoppa <igor.stoppa@huawei.com> - 2017-08-09 09:30 +0200
                Re: [RFC] Tagging of vmalloc pages for supporting the pmalloc  allocator Michal Hocko <mhocko@kernel.org> - 2017-08-10 09:20 +0200
            Re: [RFC] Tagging of vmalloc pages for supporting the pmalloc  allocator Igor Stoppa <igor.stoppa@huawei.com> - 2017-08-03 16:50 +0200

csiph-web