|
|
Log in / Subscribe / Register

hugetlb: Use PAGE granularity index in exported i/f and adopt the common read_iter

From:  Jane Chu <jane.chu-AT-oracle.com>
To:  akpm-AT-linux-foundation.org
Subject:  [PATCH v2 00/11] hugetlb: Use PAGE granularity index in exported i/f and adopt the common read_iter
Date:  Wed, 17 Jun 2026 11:25:21 -0600
Message-ID:  <20260617172534.1740152-1-jane.chu@oracle.com>
Cc:  willy-AT-infradead.org, jack-AT-suse.cz, viro-AT-zeniv.linux.org.uk, brauner-AT-kernel.org, muchun.song-AT-linux.dev, osalvador-AT-suse.de, david-AT-kernel.org, hughd-AT-google.com, baolin.wang-AT-linux.alibaba.com, linmiaohe-AT-huawei.com, nao.horiguchi-AT-gmail.com, lorenzo-AT-kernel.org, rppt-AT-kernel.org, peterx-AT-redhat.com, corbet-AT-lwn.net, linux-doc-AT-vger.kernel.org, linux-mm-AT-kvack.org, linux-kernel-AT-vger.kernel.org, linux-fsdevel-AT-vger.kernel.org
Archive-link:  Article

changes in v2:
 - new patches 1-4: add hwpoison handling to filemap_read(),
   thus replace hugetlbfs_read_iter() with generic_file_read_iter(),
   suggested by Matthew [2];
 - new patch 5: convert hugetlb fault handler's vmf->pgoff to PAGE_SIZE
   granularity like the rest of mm fault handling convention, suggested
   by Matthew [2];
 - patch 6: fixed a bug in v1 pointed out by Usama Arif, also by syzbot;
 - patch 8: did not pick the Acked-by from Oscar (for 5/6 in v1) due to
   updates to the patch;
 - patch 11: add VM_WARN_ON in hugetlb_unreserve_pages(), per Oscar;
  
v1:
This series stems from a discussion with David. [1]
The series makes a small cleanup to a few hugetlb interfaces used
outside the subsystem by standardizing them on base-page indices.
Hopefully this makes the interface semantics a bit more coherent with
the rest of mm, while the internal hugetlb code continue to use hugepage
indices where that remains the more natural fit.

[1] https://lore.kernel.org/linux-mm/9ec9edd1-0f4c-4da2-ae78-...
[2] https://lore.kernel.org/linux-mm/aeZwAz6PcdlqSnJ2@casper....


Jane Chu (11):
  mm/memory-failure: make is_raw_hwpoison_page_in_hugepage() general
    purpose
  mm: factor out adjust_range_hwpoison() from hugetlbfs
  mm/filemap: add hwpoison handling to filemap_read()
  hugetlbfs,filemap: replace hugetlbfs_read_iter() with
    generic_file_read_iter()
  hugetlb: Convert the vmf->pgoff to PAGE_SIZE granularity
  hugetlb: make hugetlb_fault_mutex_hash() to take PAGE_SIZE index
  hugetlb: replace filemap_lock_hugetlb_folio with filemap_lock_folio
  hugetlb: make hugetlb_add_to_page_cache() to take PAGE_SIZE
    granularity index
  hugetlb: remove the hugetlb_linear_page_index() helper
  hugetlb: drop vma_hugecache_offset() in favor of linear_page_index()
  hugetlb: make hugetlb_[un]reserve_pages() to take PAGE granularity
    index

 Documentation/mm/hugetlbfs_reserv.rst |  19 ++--
 fs/hugetlbfs/inode.c                  | 155 ++++----------------------
 include/linux/fs.h                    |   2 +
 include/linux/hugetlb.h               |  36 +-----
 mm/filemap.c                          |  62 ++++++++++-
 mm/hugetlb.c                          |  87 ++++++++-------
 mm/memfd.c                            |  25 ++---
 mm/memory-failure.c                   |  12 +-
 mm/userfaultfd.c                      |   6 +-
 9 files changed, 164 insertions(+), 240 deletions(-)

-- 
2.43.5




Copyright © 2026, Eklektix, Inc.
Comments and public postings are copyrighted by their creators.
Linux is a registered trademark of Linus Torvalds