lkml.org 
[lkml]   [2022]   [Sep]   [19]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [PATCH v3 4/6] mm/hugetlb: add hugetlb_set_folio_subpool() helper
On 09/08/22 12:37, Sidhartha Kumar wrote:
> Allows hugetlb subpool information to be set through a folio.
>
> Signed-off-by: Sidhartha Kumar <sidhartha.kumar@oracle.com>
> ---
> fs/hugetlbfs/inode.c | 4 ++--
> include/linux/hugetlb.h | 8 +++++++-
> 2 files changed, 9 insertions(+), 3 deletions(-)

As previously mentioned, I would suggest just combining this with the
previous patch. Changes look fine.
--
Mike Kravetz

>
> diff --git a/fs/hugetlbfs/inode.c b/fs/hugetlbfs/inode.c
> index c2e9c0cdbd81..d9e08c445e2f 100644
> --- a/fs/hugetlbfs/inode.c
> +++ b/fs/hugetlbfs/inode.c
> @@ -1152,9 +1152,9 @@ static int hugetlbfs_migrate_folio(struct address_space *mapping,
> return rc;
>
> if (hugetlb_folio_subpool(src)) {
> - hugetlb_set_page_subpool(&dst->page,
> + hugetlb_set_folio_subpool(dst,
> hugetlb_folio_subpool(src));
> - hugetlb_set_page_subpool(&src->page, NULL);
> + hugetlb_set_folio_subpool(src, NULL);
> }
>
> if (mode != MIGRATE_SYNC_NO_COPY)
> diff --git a/include/linux/hugetlb.h b/include/linux/hugetlb.h
> index 1e7c4007386e..0bcaca694ab7 100644
> --- a/include/linux/hugetlb.h
> +++ b/include/linux/hugetlb.h
> @@ -757,10 +757,16 @@ static inline struct hugepage_subpool *hugetlb_page_subpool(struct page *hpage)
> return hugetlb_folio_subpool(page_folio(hpage));
> }
>
> +static inline void hugetlb_set_folio_subpool(struct folio *folio,
> + struct hugepage_subpool *subpool)
> +{
> + folio_set_private_1(folio, (unsigned long)subpool);
> +}
> +
> static inline void hugetlb_set_page_subpool(struct page *hpage,
> struct hugepage_subpool *subpool)
> {
> - set_page_private(hpage + SUBPAGE_INDEX_SUBPOOL, (unsigned long)subpool);
> + hugetlb_set_folio_subpool(page_folio(hpage), subpool);
> }
>
> static inline struct hstate *hstate_file(struct file *f)
> --
> 2.31.1
>

\
 
 \ /
  Last update: 2022-09-20 00:27    [W:1.653 / U:0.168 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site