memblock_reserve or memblock_remove to reserve a page
Arun Sudhilal
getarunks at gmail.com
Wed Sep 28 05:42:43 EDT 2016
Hello Nikhil,
On Wed, Sep 28, 2016 at 2:41 PM, Nikhil Utane
<nikhil.subscribed at gmail.com> wrote:
> Arun,
>
> What seems to have done the trick is calling memblock_remove() followed by a
> call to request_mem_region(). This creates a hole which can be confirmed in
> the output of /proc/iomem.
>
> Do you see any issue with this approach?
I really don't know how it works for you. Marking address of a page as
iomem. How buddy allocator ignores this page?
request_mem_region() is a way of managing IO resource memory, to avoid
two drivers using same IO memory. It has not relation with buddy
allocator.
Can you post code snippet?
Regards,
Arun
>
> -Thanks
> Nikhil
>
> On Tue, Sep 27, 2016 at 4:14 PM, Arun Sudhilal <getarunks at gmail.com> wrote:
>>
>> Hello Nikhil,
>>
>> On Fri, Sep 9, 2016 at 7:01 AM, Nikhil Utane
>> <nikhil.subscribed at gmail.com> wrote:
>> > I want to reserve a physical memory page with a fixed PFN. I do not want
>> > this page to be used by anyone else. I am calling memblock_reserve() to
>> > supposedly reserve the page. I am writing some content into this page.
>> > What
>> > I see is that during some runs the content of this page is modified
>> > (either
>> > fully or sometimes partially). In few runs, I see it as intact. Is it
>> > expected that even after calling memblock_reserve() the kernel can
>> > allocate
>> > this physical page for any other purpose? How is memblock_remove()
>> > different
>> > from memblock_reserve? I tried reading up but didn't see any useful
>> > information. What I understood is memblock_remove will completely remove
>> > from kernel's allocation mechanism. Should I then be using remove
>> > instead of
>> > reserve?
>>
>> when a DT entry is added to #reserved-memory node, what
>> drivers/of/fdt.c does is to call memblock_remove() and
>> memblock_reserve().
>> This happens after the memblock driver is initialized but before buddy
>> allocator up. Did you try this approach? This should work for you.
>>
>> Only option once the kernel boot is complete is to try out the
>> technique what mm/memory_hotplug.c does while offline memory.
>> isolate_page_range and then migrate.
>>
>> Regards,
>> Arun
>>
>>
>> >
>> > -Thanks
>> > Nikhil
>> >
>> > _______________________________________________
>> > Kernelnewbies mailing list
>> > Kernelnewbies at kernelnewbies.org
>> > https://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies
>> >
>
>
More information about the Kernelnewbies
mailing list