Skip to content

Commit 02d1426

Browse files
robntonyhutter
authored andcommitted
linux/abd_os: remove kernel version check for compound page support
All kernels we support have compound pages that work the way we would like. However, this code is new and this knowledge was hard won, so I'd like to leave the description and option there for a little while, even if it can only be disabled with a recompile. Sponsored-by: https://despairlabs.com/sponsor/ Reviewed by: Brian Behlendorf <[email protected]> Reviewed-by: Alexander Motin <[email protected]> Reviewed-by: Tino Reichardt <[email protected]> Signed-off-by: Rob Norris <[email protected]> Closes openzfs#16545
1 parent 59b3256 commit 02d1426

File tree

1 file changed

+18
-11
lines changed

1 file changed

+18
-11
lines changed

module/os/linux/zfs/abd_os.c

Lines changed: 18 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1039,23 +1039,30 @@ abd_cache_reap_now(void)
10391039
* Before kernel 4.5 however, compound page heads were refcounted separately
10401040
* from tail pages, such that moving back to the head page would require us to
10411041
* take a reference to it and releasing it once we're completely finished with
1042-
* it. In practice, that means when our caller is done with the ABD, which we
1042+
* it. In practice, that meant when our caller is done with the ABD, which we
10431043
* have no insight into from here. Rather than contort this API to track head
1044-
* page references on such ancient kernels, we disable this special compound
1045-
* page handling on 4.5, instead just using treating each page within it as a
1046-
* regular PAGESIZE page (which it is). This is slightly less efficient, but
1047-
* makes everything far simpler.
1044+
* page references on such ancient kernels, we disabled this special compound
1045+
* page handling on kernels before 4.5, instead just using treating each page
1046+
* within it as a regular PAGESIZE page (which it is). This is slightly less
1047+
* efficient, but makes everything far simpler.
10481048
*
1049-
* The below test sets/clears ABD_ITER_COMPOUND_PAGES to enable/disable the
1050-
* special handling, and also defines the ABD_ITER_PAGE_SIZE(page) macro to
1051-
* understand compound pages, or not, as required.
1049+
* We no longer support kernels before 4.5, so in theory none of this is
1050+
* necessary. However, this code is still relatively new in the grand scheme of
1051+
* things, so I'm leaving the ability to compile this out for the moment.
1052+
*
1053+
* Setting/clearing ABD_ITER_COMPOUND_PAGES below enables/disables the special
1054+
* handling, by defining the ABD_ITER_PAGE_SIZE(page) macro to understand
1055+
* compound pages, or not, and compiling in/out the support to detect compound
1056+
* tail pages and move back to the start.
10521057
*/
1053-
#if LINUX_VERSION_CODE >= KERNEL_VERSION(4, 5, 0)
1054-
#define ABD_ITER_COMPOUND_PAGES 1
1058+
1059+
/* On by default */
1060+
#define ABD_ITER_COMPOUND_PAGES
1061+
1062+
#ifdef ABD_ITER_COMPOUND_PAGES
10551063
#define ABD_ITER_PAGE_SIZE(page) \
10561064
(PageCompound(page) ? page_size(page) : PAGESIZE)
10571065
#else
1058-
#undef ABD_ITER_COMPOUND_PAGES
10591066
#define ABD_ITER_PAGE_SIZE(page) (PAGESIZE)
10601067
#endif
10611068

0 commit comments

Comments
 (0)