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


Groups > linux.kernel > #1707097

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-09 09:30 +0200
Message-ID <uctBf-3T7-5@gated-at.bofh.it> (permalink)
References (6 earlier) <ubQqd-nB-9@gated-at.bofh.it> <ubR2W-W5-27@gated-at.bofh.it> <ubVJf-4vV-1@gated-at.bofh.it> <uccqJ-ny-5@gated-at.bofh.it> <uclX4-70m-23@gated-at.bofh.it>
Organization linux.* mail to news gateway

Show all headers | View raw



On 09/08/17 02:15, Jerome Glisse wrote:
> On Tue, Aug 08, 2017 at 03:59:36PM +0300, Igor Stoppa wrote:

[...]

>> I am tempted to add
>>
>> #define VM_PMALLOC		0x00000100

[...]

> VM_PMALLOC sounds fine to me also adding a comment there pointing to
> pmalloc documentation would be a good thing to do. The above are flags
> that are use only inside vmalloc context and so there is no issue
> here of conflicting with other potential user.

ok, will do

>>
>> Unless it's acceptable to check the private field in the page struct.
>> It would bear the pmalloc magic number.
> 
> I thought you wanted to do:
>   check struct page mapping field
>   check vmap->flags for VM_PMALLOC
> 
> bool is_pmalloc(unsigned long addr)
> {
>     struct page *page;
>     struct vm_struct *vm_struct;
> 
>     if (!is_vmalloc_addr(addr))
>         return false;
>     page = vmalloc_to_page(addr);
>     if (!page)
>         return false;
>     if (page->mapping != pmalloc_magic_key)

page->private  ?
I thought mapping would not work in the cases you mentioned?

>         return false;
> 
>     vm_struct = find_vm_area(addr);
>     if (!vm_struct)
>         return false;
> 
>     return vm_struct->flags & VM_PMALLOC;
> }
> 
> Did you change your plan ?

No, the code I have is almost 1:1 what you wrote.
Apart from mapping <=> private

In my previous mail I referred to page->private.

Maybe I was not very clear in what I wrote, but I'm almost 100% aligned
with your snippet.

>> I'm thinking to use a pointer to one of pmalloc data items, as signature.
> 
> What ever is easier for you. Note that dereferencing such pointer before
> asserting this is really a pmalloc page would be hazardous.

Yes, it's not even needed in this scenario.
It was just a way to ensure that it would be a value that cannot be come
out accidentally as pointer value, since it is already taken.

--
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