Re: [PATCH v3 3/3] x86/mm: add TLB purge to free pmd/pte page interfaces

2018-05-30 Thread Kani, Toshi
On Wed, 2018-05-30 at 06:59 +0200, j...@8bytes.org wrote: > On Tue, May 29, 2018 at 04:10:24PM +, Kani, Toshi wrote: > > Can you explain why you think allocating a page here is a major problem? > > Because a larger allocation is more likely to fail. And if you fail the > allocation, you also

Re: [PATCH v3 3/3] x86/mm: add TLB purge to free pmd/pte page interfaces

2018-05-30 Thread Kani, Toshi
On Wed, 2018-05-30 at 06:59 +0200, j...@8bytes.org wrote: > On Tue, May 29, 2018 at 04:10:24PM +, Kani, Toshi wrote: > > Can you explain why you think allocating a page here is a major problem? > > Because a larger allocation is more likely to fail. And if you fail the > allocation, you also

Re: [PATCH v3 3/3] x86/mm: add TLB purge to free pmd/pte page interfaces

2018-05-29 Thread j...@8bytes.org
On Tue, May 29, 2018 at 04:10:24PM +, Kani, Toshi wrote: > Can you explain why you think allocating a page here is a major problem? Because a larger allocation is more likely to fail. And if you fail the allocation, you also fail to free more pages, which _is_ a problem. So better avoid any

Re: [PATCH v3 3/3] x86/mm: add TLB purge to free pmd/pte page interfaces

2018-05-29 Thread j...@8bytes.org
On Tue, May 29, 2018 at 04:10:24PM +, Kani, Toshi wrote: > Can you explain why you think allocating a page here is a major problem? Because a larger allocation is more likely to fail. And if you fail the allocation, you also fail to free more pages, which _is_ a problem. So better avoid any

Re: [PATCH v3 3/3] x86/mm: add TLB purge to free pmd/pte page interfaces

2018-05-29 Thread Kani, Toshi
On Tue, 2018-05-29 at 16:44 +0200, Joerg Roedel wrote: > On Wed, May 16, 2018 at 05:32:07PM -0600, Toshi Kani wrote: > > pmd = (pmd_t *)pud_page_vaddr(*pud); > > + pmd_sv = (pmd_t *)__get_free_page(GFP_KERNEL); > > + if (!pmd_sv) > > + return 0; > > So your code still needs to

Re: [PATCH v3 3/3] x86/mm: add TLB purge to free pmd/pte page interfaces

2018-05-29 Thread Kani, Toshi
On Tue, 2018-05-29 at 16:44 +0200, Joerg Roedel wrote: > On Wed, May 16, 2018 at 05:32:07PM -0600, Toshi Kani wrote: > > pmd = (pmd_t *)pud_page_vaddr(*pud); > > + pmd_sv = (pmd_t *)__get_free_page(GFP_KERNEL); > > + if (!pmd_sv) > > + return 0; > > So your code still needs to

Re: [PATCH v3 3/3] x86/mm: add TLB purge to free pmd/pte page interfaces

2018-05-29 Thread Joerg Roedel
On Wed, May 16, 2018 at 05:32:07PM -0600, Toshi Kani wrote: > pmd = (pmd_t *)pud_page_vaddr(*pud); > + pmd_sv = (pmd_t *)__get_free_page(GFP_KERNEL); > + if (!pmd_sv) > + return 0; So your code still needs to allocate a full page where a simple list_head on the stack

Re: [PATCH v3 3/3] x86/mm: add TLB purge to free pmd/pte page interfaces

2018-05-29 Thread Joerg Roedel
On Wed, May 16, 2018 at 05:32:07PM -0600, Toshi Kani wrote: > pmd = (pmd_t *)pud_page_vaddr(*pud); > + pmd_sv = (pmd_t *)__get_free_page(GFP_KERNEL); > + if (!pmd_sv) > + return 0; So your code still needs to allocate a full page where a simple list_head on the stack

[PATCH v3 3/3] x86/mm: add TLB purge to free pmd/pte page interfaces

2018-05-16 Thread Toshi Kani
ioremap() calls pud_free_pmd_page() / pmd_free_pte_page() when it creates a pud / pmd map. The following preconditions are met at their entry. - All pte entries for a target pud/pmd address range have been cleared. - System-wide TLB purges have been peformed for a target pud/pmd address

[PATCH v3 3/3] x86/mm: add TLB purge to free pmd/pte page interfaces

2018-05-16 Thread Toshi Kani
ioremap() calls pud_free_pmd_page() / pmd_free_pte_page() when it creates a pud / pmd map. The following preconditions are met at their entry. - All pte entries for a target pud/pmd address range have been cleared. - System-wide TLB purges have been peformed for a target pud/pmd address