Page MenuHomeFreeBSD

Use M_NOWAIT when allocating the ACPI wakeup handler
ClosedPublic

Authored by markj on Jun 23 2016, 6:13 PM.
Tags
None
Referenced Files
Unknown Object (File)
Thu, Nov 28, 5:05 AM
Unknown Object (File)
Thu, Nov 28, 5:01 AM
Unknown Object (File)
Sun, Nov 24, 2:55 AM
Unknown Object (File)
Nov 9 2024, 4:29 PM
Unknown Object (File)
Nov 8 2024, 4:48 AM
Unknown Object (File)
Nov 8 2024, 1:52 AM
Unknown Object (File)
Nov 6 2024, 1:08 AM
Unknown Object (File)
Nov 6 2024, 1:08 AM
Subscribers

Details

Summary

If the allocation attempt fails, we may appear to hang during boot as
kmem_alloc_contig() will VM_WAIT after a failed attempt to defragment
memory. It seems that prior to r297466 we would have just returned
immediately.

I see these allocation failures on VMWare instances with 2GB of RAM.

Diff Detail

Repository
rS FreeBSD src repository - subversion
Lint
Lint Not Applicable
Unit
Tests Not Applicable

Event Timeline

markj retitled this revision from to Use M_NOWAIT when allocating the ACPI wakeup handler.
markj edited the test plan for this revision. (Show Details)
markj updated this object.
jkim edited edge metadata.
This revision is now accepted and ready to land.Jun 23 2016, 6:18 PM
kib edited edge metadata.

I do not see why not.

A note is that there is probably no need to allocate all pages contiguous in phys memory, then the chance of the allocation succeeding should be much higher.

This revision was automatically updated to reflect the committed changes.
In D6945#145652, @kib wrote:

A note is that there is probably no need to allocate all pages contiguous in phys memory, then the chance of the allocation succeeding should be much higher.

Hm, that's not obvious to me from a quick look at the code. acpi_install_wakeup_handler() makes use of the base physical address of the range returned by contigmalloc().

In D6945#145668, @markj wrote:
In D6945#145652, @kib wrote:

A note is that there is probably no need to allocate all pages contiguous in phys memory, then the chance of the allocation succeeding should be much higher.

Hm, that's not obvious to me from a quick look at the code. acpi_install_wakeup_handler() makes use of the base physical address of the range returned by contigmalloc().

The allocation, AFAIU, is 1 page for the wakeup code, and three pages for minimal page table page mapping low 1G in repeated pattern over whole AS. If this is correct, I do not see why page tables must be physically contiguous or adjacent to the wakeup code.

The allocation, AFAIU, is 1 page for the wakeup code, and three pages for minimal page table page mapping low 1G in repeated pattern over whole AS. If this is correct, I do not see why page tables must be physically contiguous or adjacent to the wakeup code.

Correct. It just made the code simpler, though.

In D6945#145669, @kib wrote:

The allocation, AFAIU, is 1 page for the wakeup code, and three pages for minimal page table page mapping low 1G in repeated pattern over whole AS. If this is correct, I do not see why page tables must be physically contiguous or adjacent to the wakeup code.

I see, thanks.