Re: [PATCH v2 03/20] mm, hugetlb: fix subpool accounting handling
On Mon, Aug 26, 2013 at 06:31:35PM +0530, Aneesh Kumar K.V wrote: > Joonsoo Kim writes: > > > On Thu, Aug 22, 2013 at 12:38:12PM +0530, Aneesh Kumar K.V wrote: > >> Joonsoo Kim writes: > >> > >> > Hello, Aneesh. > >> > > >> > First of all, thank you for review! > >> > > >> > On Wed, Aug 21, 2013 at 02:58:20PM +0530, Aneesh Kumar K.V wrote: > >> >> Joonsoo Kim writes: > >> >> > >> >> > If we alloc hugepage with avoid_reserve, we don't dequeue reserved > >> >> > one. > >> >> > So, we should check subpool counter when avoid_reserve. > >> >> > This patch implement it. > >> >> > >> >> Can you explain this better ? ie, if we don't have a reservation in the > >> >> area chg != 0. So why look at avoid_reserve. > >> > > >> > We don't consider avoid_reserve when chg != 0. > >> > Look at following code. > >> > > >> > + if (chg || avoid_reserve) > >> > + if (hugepage_subpool_get_pages(spool, 1)) > >> > > >> > It means that if chg != 0, we skip to check avoid_reserve. > >> > >> when whould be avoid_reserve == 1 and chg == 0 ? > > > > In this case, we should do hugepage_subpool_get_pages(), since we don't > > get a reserved page due to avoid_reserve. > > As per off-list discussion we had around this, please add additional > information in commit message explaining when we have > avoid_reserve == 1 and chg == 0 Okay! > > Something like the below copied from call site. > >/* If the process that created a MAP_PRIVATE mapping is about to > * perform a COW due to a shared page count, attempt to satisfy > * the allocation without using the existing reserves > */ > > Reviewed-by: Aneesh Kumar K.V Thanks. -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
Re: [PATCH v2 03/20] mm, hugetlb: fix subpool accounting handling
On Mon, Aug 26, 2013 at 06:31:35PM +0530, Aneesh Kumar K.V wrote: Joonsoo Kim iamjoonsoo@lge.com writes: On Thu, Aug 22, 2013 at 12:38:12PM +0530, Aneesh Kumar K.V wrote: Joonsoo Kim iamjoonsoo@lge.com writes: Hello, Aneesh. First of all, thank you for review! On Wed, Aug 21, 2013 at 02:58:20PM +0530, Aneesh Kumar K.V wrote: Joonsoo Kim iamjoonsoo@lge.com writes: If we alloc hugepage with avoid_reserve, we don't dequeue reserved one. So, we should check subpool counter when avoid_reserve. This patch implement it. Can you explain this better ? ie, if we don't have a reservation in the area chg != 0. So why look at avoid_reserve. We don't consider avoid_reserve when chg != 0. Look at following code. + if (chg || avoid_reserve) + if (hugepage_subpool_get_pages(spool, 1)) It means that if chg != 0, we skip to check avoid_reserve. when whould be avoid_reserve == 1 and chg == 0 ? In this case, we should do hugepage_subpool_get_pages(), since we don't get a reserved page due to avoid_reserve. As per off-list discussion we had around this, please add additional information in commit message explaining when we have avoid_reserve == 1 and chg == 0 Okay! Something like the below copied from call site. /* If the process that created a MAP_PRIVATE mapping is about to * perform a COW due to a shared page count, attempt to satisfy * the allocation without using the existing reserves */ Reviewed-by: Aneesh Kumar K.V aneesh.ku...@linux.vnet.ibm.com Thanks. -- To unsubscribe from this list: send the line unsubscribe linux-kernel in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
Re: [PATCH v2 03/20] mm, hugetlb: fix subpool accounting handling
Joonsoo Kim writes: > On Thu, Aug 22, 2013 at 12:38:12PM +0530, Aneesh Kumar K.V wrote: >> Joonsoo Kim writes: >> >> > Hello, Aneesh. >> > >> > First of all, thank you for review! >> > >> > On Wed, Aug 21, 2013 at 02:58:20PM +0530, Aneesh Kumar K.V wrote: >> >> Joonsoo Kim writes: >> >> >> >> > If we alloc hugepage with avoid_reserve, we don't dequeue reserved one. >> >> > So, we should check subpool counter when avoid_reserve. >> >> > This patch implement it. >> >> >> >> Can you explain this better ? ie, if we don't have a reservation in the >> >> area chg != 0. So why look at avoid_reserve. >> > >> > We don't consider avoid_reserve when chg != 0. >> > Look at following code. >> > >> > + if (chg || avoid_reserve) >> > + if (hugepage_subpool_get_pages(spool, 1)) >> > >> > It means that if chg != 0, we skip to check avoid_reserve. >> >> when whould be avoid_reserve == 1 and chg == 0 ? > > In this case, we should do hugepage_subpool_get_pages(), since we don't > get a reserved page due to avoid_reserve. As per off-list discussion we had around this, please add additional information in commit message explaining when we have avoid_reserve == 1 and chg == 0 Something like the below copied from call site. /* If the process that created a MAP_PRIVATE mapping is about to * perform a COW due to a shared page count, attempt to satisfy * the allocation without using the existing reserves */ Reviewed-by: Aneesh Kumar K.V -aneesh -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
Re: [PATCH v2 03/20] mm, hugetlb: fix subpool accounting handling
Joonsoo Kim iamjoonsoo@lge.com writes: On Thu, Aug 22, 2013 at 12:38:12PM +0530, Aneesh Kumar K.V wrote: Joonsoo Kim iamjoonsoo@lge.com writes: Hello, Aneesh. First of all, thank you for review! On Wed, Aug 21, 2013 at 02:58:20PM +0530, Aneesh Kumar K.V wrote: Joonsoo Kim iamjoonsoo@lge.com writes: If we alloc hugepage with avoid_reserve, we don't dequeue reserved one. So, we should check subpool counter when avoid_reserve. This patch implement it. Can you explain this better ? ie, if we don't have a reservation in the area chg != 0. So why look at avoid_reserve. We don't consider avoid_reserve when chg != 0. Look at following code. + if (chg || avoid_reserve) + if (hugepage_subpool_get_pages(spool, 1)) It means that if chg != 0, we skip to check avoid_reserve. when whould be avoid_reserve == 1 and chg == 0 ? In this case, we should do hugepage_subpool_get_pages(), since we don't get a reserved page due to avoid_reserve. As per off-list discussion we had around this, please add additional information in commit message explaining when we have avoid_reserve == 1 and chg == 0 Something like the below copied from call site. /* If the process that created a MAP_PRIVATE mapping is about to * perform a COW due to a shared page count, attempt to satisfy * the allocation without using the existing reserves */ Reviewed-by: Aneesh Kumar K.V aneesh.ku...@linux.vnet.ibm.com -aneesh -- To unsubscribe from this list: send the line unsubscribe linux-kernel in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
Re: [PATCH v2 03/20] mm, hugetlb: fix subpool accounting handling
On Thu, Aug 22, 2013 at 12:38:12PM +0530, Aneesh Kumar K.V wrote: > Joonsoo Kim writes: > > > Hello, Aneesh. > > > > First of all, thank you for review! > > > > On Wed, Aug 21, 2013 at 02:58:20PM +0530, Aneesh Kumar K.V wrote: > >> Joonsoo Kim writes: > >> > >> > If we alloc hugepage with avoid_reserve, we don't dequeue reserved one. > >> > So, we should check subpool counter when avoid_reserve. > >> > This patch implement it. > >> > >> Can you explain this better ? ie, if we don't have a reservation in the > >> area chg != 0. So why look at avoid_reserve. > > > > We don't consider avoid_reserve when chg != 0. > > Look at following code. > > > > + if (chg || avoid_reserve) > > + if (hugepage_subpool_get_pages(spool, 1)) > > > > It means that if chg != 0, we skip to check avoid_reserve. > > when whould be avoid_reserve == 1 and chg == 0 ? In this case, we should do hugepage_subpool_get_pages(), since we don't get a reserved page due to avoid_reserve. Thanks. -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
Re: [PATCH v2 03/20] mm, hugetlb: fix subpool accounting handling
Joonsoo Kim writes: > Hello, Aneesh. > > First of all, thank you for review! > > On Wed, Aug 21, 2013 at 02:58:20PM +0530, Aneesh Kumar K.V wrote: >> Joonsoo Kim writes: >> >> > If we alloc hugepage with avoid_reserve, we don't dequeue reserved one. >> > So, we should check subpool counter when avoid_reserve. >> > This patch implement it. >> >> Can you explain this better ? ie, if we don't have a reservation in the >> area chg != 0. So why look at avoid_reserve. > > We don't consider avoid_reserve when chg != 0. > Look at following code. > > + if (chg || avoid_reserve) > + if (hugepage_subpool_get_pages(spool, 1)) > > It means that if chg != 0, we skip to check avoid_reserve. when whould be avoid_reserve == 1 and chg == 0 ? -aneesh -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
Re: [PATCH v2 03/20] mm, hugetlb: fix subpool accounting handling
Hello, Aneesh. First of all, thank you for review! On Wed, Aug 21, 2013 at 02:58:20PM +0530, Aneesh Kumar K.V wrote: > Joonsoo Kim writes: > > > If we alloc hugepage with avoid_reserve, we don't dequeue reserved one. > > So, we should check subpool counter when avoid_reserve. > > This patch implement it. > > Can you explain this better ? ie, if we don't have a reservation in the > area chg != 0. So why look at avoid_reserve. We don't consider avoid_reserve when chg != 0. Look at following code. + if (chg || avoid_reserve) + if (hugepage_subpool_get_pages(spool, 1)) It means that if chg != 0, we skip to check avoid_reserve. > > Also the code will become if you did > > if (!chg && avoid_reserve) >chg = 1; > > and then rest of the code will be able to handle the case. We still pass avoid_reserve to dequeue_huge_page_vma() and check avoid_reserve there, so maintaining avoid_reserve and checking it separately is better to understand a logic. And it doesn't matter at all since I eventually unify these in patch 13. Thanks. -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
Re: [PATCH v2 03/20] mm, hugetlb: fix subpool accounting handling
Hello, Aneesh. First of all, thank you for review! On Wed, Aug 21, 2013 at 02:58:20PM +0530, Aneesh Kumar K.V wrote: Joonsoo Kim iamjoonsoo@lge.com writes: If we alloc hugepage with avoid_reserve, we don't dequeue reserved one. So, we should check subpool counter when avoid_reserve. This patch implement it. Can you explain this better ? ie, if we don't have a reservation in the area chg != 0. So why look at avoid_reserve. We don't consider avoid_reserve when chg != 0. Look at following code. + if (chg || avoid_reserve) + if (hugepage_subpool_get_pages(spool, 1)) It means that if chg != 0, we skip to check avoid_reserve. Also the code will become if you did if (!chg avoid_reserve) chg = 1; and then rest of the code will be able to handle the case. We still pass avoid_reserve to dequeue_huge_page_vma() and check avoid_reserve there, so maintaining avoid_reserve and checking it separately is better to understand a logic. And it doesn't matter at all since I eventually unify these in patch 13. Thanks. -- To unsubscribe from this list: send the line unsubscribe linux-kernel in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
Re: [PATCH v2 03/20] mm, hugetlb: fix subpool accounting handling
Joonsoo Kim iamjoonsoo@lge.com writes: Hello, Aneesh. First of all, thank you for review! On Wed, Aug 21, 2013 at 02:58:20PM +0530, Aneesh Kumar K.V wrote: Joonsoo Kim iamjoonsoo@lge.com writes: If we alloc hugepage with avoid_reserve, we don't dequeue reserved one. So, we should check subpool counter when avoid_reserve. This patch implement it. Can you explain this better ? ie, if we don't have a reservation in the area chg != 0. So why look at avoid_reserve. We don't consider avoid_reserve when chg != 0. Look at following code. + if (chg || avoid_reserve) + if (hugepage_subpool_get_pages(spool, 1)) It means that if chg != 0, we skip to check avoid_reserve. when whould be avoid_reserve == 1 and chg == 0 ? -aneesh -- To unsubscribe from this list: send the line unsubscribe linux-kernel in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
Re: [PATCH v2 03/20] mm, hugetlb: fix subpool accounting handling
On Thu, Aug 22, 2013 at 12:38:12PM +0530, Aneesh Kumar K.V wrote: Joonsoo Kim iamjoonsoo@lge.com writes: Hello, Aneesh. First of all, thank you for review! On Wed, Aug 21, 2013 at 02:58:20PM +0530, Aneesh Kumar K.V wrote: Joonsoo Kim iamjoonsoo@lge.com writes: If we alloc hugepage with avoid_reserve, we don't dequeue reserved one. So, we should check subpool counter when avoid_reserve. This patch implement it. Can you explain this better ? ie, if we don't have a reservation in the area chg != 0. So why look at avoid_reserve. We don't consider avoid_reserve when chg != 0. Look at following code. + if (chg || avoid_reserve) + if (hugepage_subpool_get_pages(spool, 1)) It means that if chg != 0, we skip to check avoid_reserve. when whould be avoid_reserve == 1 and chg == 0 ? In this case, we should do hugepage_subpool_get_pages(), since we don't get a reserved page due to avoid_reserve. Thanks. -- To unsubscribe from this list: send the line unsubscribe linux-kernel in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
Re: [PATCH v2 03/20] mm, hugetlb: fix subpool accounting handling
Joonsoo Kim writes: > If we alloc hugepage with avoid_reserve, we don't dequeue reserved one. > So, we should check subpool counter when avoid_reserve. > This patch implement it. Can you explain this better ? ie, if we don't have a reservation in the area chg != 0. So why look at avoid_reserve. Also the code will become if you did if (!chg && avoid_reserve) chg = 1; and then rest of the code will be able to handle the case. > > Signed-off-by: Joonsoo Kim > > diff --git a/mm/hugetlb.c b/mm/hugetlb.c > index 12b6581..ea1ae0a 100644 > --- a/mm/hugetlb.c > +++ b/mm/hugetlb.c > @@ -1144,13 +1144,14 @@ static struct page *alloc_huge_page(struct > vm_area_struct *vma, > chg = vma_needs_reservation(h, vma, addr); > if (chg < 0) > return ERR_PTR(-ENOMEM); > - if (chg) > - if (hugepage_subpool_get_pages(spool, chg)) > + if (chg || avoid_reserve) > + if (hugepage_subpool_get_pages(spool, 1)) > return ERR_PTR(-ENOSPC); > > ret = hugetlb_cgroup_charge_cgroup(idx, pages_per_huge_page(h), _cg); > if (ret) { > - hugepage_subpool_put_pages(spool, chg); > + if (chg || avoid_reserve) > + hugepage_subpool_put_pages(spool, 1); > return ERR_PTR(-ENOSPC); > } > spin_lock(_lock); > @@ -1162,7 +1163,8 @@ static struct page *alloc_huge_page(struct > vm_area_struct *vma, > hugetlb_cgroup_uncharge_cgroup(idx, > pages_per_huge_page(h), > h_cg); > - hugepage_subpool_put_pages(spool, chg); > + if (chg || avoid_reserve) > + hugepage_subpool_put_pages(spool, 1); > return ERR_PTR(-ENOSPC); > } > spin_lock(_lock); > -- > 1.7.9.5 -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
Re: [PATCH v2 03/20] mm, hugetlb: fix subpool accounting handling
Joonsoo Kim iamjoonsoo@lge.com writes: If we alloc hugepage with avoid_reserve, we don't dequeue reserved one. So, we should check subpool counter when avoid_reserve. This patch implement it. Can you explain this better ? ie, if we don't have a reservation in the area chg != 0. So why look at avoid_reserve. Also the code will become if you did if (!chg avoid_reserve) chg = 1; and then rest of the code will be able to handle the case. Signed-off-by: Joonsoo Kim iamjoonsoo@lge.com diff --git a/mm/hugetlb.c b/mm/hugetlb.c index 12b6581..ea1ae0a 100644 --- a/mm/hugetlb.c +++ b/mm/hugetlb.c @@ -1144,13 +1144,14 @@ static struct page *alloc_huge_page(struct vm_area_struct *vma, chg = vma_needs_reservation(h, vma, addr); if (chg 0) return ERR_PTR(-ENOMEM); - if (chg) - if (hugepage_subpool_get_pages(spool, chg)) + if (chg || avoid_reserve) + if (hugepage_subpool_get_pages(spool, 1)) return ERR_PTR(-ENOSPC); ret = hugetlb_cgroup_charge_cgroup(idx, pages_per_huge_page(h), h_cg); if (ret) { - hugepage_subpool_put_pages(spool, chg); + if (chg || avoid_reserve) + hugepage_subpool_put_pages(spool, 1); return ERR_PTR(-ENOSPC); } spin_lock(hugetlb_lock); @@ -1162,7 +1163,8 @@ static struct page *alloc_huge_page(struct vm_area_struct *vma, hugetlb_cgroup_uncharge_cgroup(idx, pages_per_huge_page(h), h_cg); - hugepage_subpool_put_pages(spool, chg); + if (chg || avoid_reserve) + hugepage_subpool_put_pages(spool, 1); return ERR_PTR(-ENOSPC); } spin_lock(hugetlb_lock); -- 1.7.9.5 -- To unsubscribe from this list: send the line unsubscribe linux-kernel in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
[PATCH v2 03/20] mm, hugetlb: fix subpool accounting handling
If we alloc hugepage with avoid_reserve, we don't dequeue reserved one. So, we should check subpool counter when avoid_reserve. This patch implement it. Signed-off-by: Joonsoo Kim diff --git a/mm/hugetlb.c b/mm/hugetlb.c index 12b6581..ea1ae0a 100644 --- a/mm/hugetlb.c +++ b/mm/hugetlb.c @@ -1144,13 +1144,14 @@ static struct page *alloc_huge_page(struct vm_area_struct *vma, chg = vma_needs_reservation(h, vma, addr); if (chg < 0) return ERR_PTR(-ENOMEM); - if (chg) - if (hugepage_subpool_get_pages(spool, chg)) + if (chg || avoid_reserve) + if (hugepage_subpool_get_pages(spool, 1)) return ERR_PTR(-ENOSPC); ret = hugetlb_cgroup_charge_cgroup(idx, pages_per_huge_page(h), _cg); if (ret) { - hugepage_subpool_put_pages(spool, chg); + if (chg || avoid_reserve) + hugepage_subpool_put_pages(spool, 1); return ERR_PTR(-ENOSPC); } spin_lock(_lock); @@ -1162,7 +1163,8 @@ static struct page *alloc_huge_page(struct vm_area_struct *vma, hugetlb_cgroup_uncharge_cgroup(idx, pages_per_huge_page(h), h_cg); - hugepage_subpool_put_pages(spool, chg); + if (chg || avoid_reserve) + hugepage_subpool_put_pages(spool, 1); return ERR_PTR(-ENOSPC); } spin_lock(_lock); -- 1.7.9.5 -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
[PATCH v2 03/20] mm, hugetlb: fix subpool accounting handling
If we alloc hugepage with avoid_reserve, we don't dequeue reserved one. So, we should check subpool counter when avoid_reserve. This patch implement it. Signed-off-by: Joonsoo Kim iamjoonsoo@lge.com diff --git a/mm/hugetlb.c b/mm/hugetlb.c index 12b6581..ea1ae0a 100644 --- a/mm/hugetlb.c +++ b/mm/hugetlb.c @@ -1144,13 +1144,14 @@ static struct page *alloc_huge_page(struct vm_area_struct *vma, chg = vma_needs_reservation(h, vma, addr); if (chg 0) return ERR_PTR(-ENOMEM); - if (chg) - if (hugepage_subpool_get_pages(spool, chg)) + if (chg || avoid_reserve) + if (hugepage_subpool_get_pages(spool, 1)) return ERR_PTR(-ENOSPC); ret = hugetlb_cgroup_charge_cgroup(idx, pages_per_huge_page(h), h_cg); if (ret) { - hugepage_subpool_put_pages(spool, chg); + if (chg || avoid_reserve) + hugepage_subpool_put_pages(spool, 1); return ERR_PTR(-ENOSPC); } spin_lock(hugetlb_lock); @@ -1162,7 +1163,8 @@ static struct page *alloc_huge_page(struct vm_area_struct *vma, hugetlb_cgroup_uncharge_cgroup(idx, pages_per_huge_page(h), h_cg); - hugepage_subpool_put_pages(spool, chg); + if (chg || avoid_reserve) + hugepage_subpool_put_pages(spool, 1); return ERR_PTR(-ENOSPC); } spin_lock(hugetlb_lock); -- 1.7.9.5 -- To unsubscribe from this list: send the line unsubscribe linux-kernel in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/