Skip to content

Commit b7e43d6

Browse files
robnbehlendorf
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 #16545
1 parent a83762b commit b7e43d6

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
@@ -1081,23 +1081,30 @@ abd_return_buf_copy(abd_t *abd, void *buf, size_t n)
10811081
* Before kernel 4.5 however, compound page heads were refcounted separately
10821082
* from tail pages, such that moving back to the head page would require us to
10831083
* take a reference to it and releasing it once we're completely finished with
1084-
* it. In practice, that means when our caller is done with the ABD, which we
1084+
* it. In practice, that meant when our caller is done with the ABD, which we
10851085
* have no insight into from here. Rather than contort this API to track head
1086-
* page references on such ancient kernels, we disable this special compound
1087-
* page handling on 4.5, instead just using treating each page within it as a
1088-
* regular PAGESIZE page (which it is). This is slightly less efficient, but
1089-
* makes everything far simpler.
1086+
* page references on such ancient kernels, we disabled this special compound
1087+
* page handling on kernels before 4.5, instead just using treating each page
1088+
* within it as a regular PAGESIZE page (which it is). This is slightly less
1089+
* efficient, but makes everything far simpler.
10901090
*
1091-
* The below test sets/clears ABD_ITER_COMPOUND_PAGES to enable/disable the
1092-
* special handling, and also defines the ABD_ITER_PAGE_SIZE(page) macro to
1093-
* understand compound pages, or not, as required.
1091+
* We no longer support kernels before 4.5, so in theory none of this is
1092+
* necessary. However, this code is still relatively new in the grand scheme of
1093+
* things, so I'm leaving the ability to compile this out for the moment.
1094+
*
1095+
* Setting/clearing ABD_ITER_COMPOUND_PAGES below enables/disables the special
1096+
* handling, by defining the ABD_ITER_PAGE_SIZE(page) macro to understand
1097+
* compound pages, or not, and compiling in/out the support to detect compound
1098+
* tail pages and move back to the start.
10941099
*/
1095-
#if LINUX_VERSION_CODE >= KERNEL_VERSION(4, 5, 0)
1096-
#define ABD_ITER_COMPOUND_PAGES 1
1100+
1101+
/* On by default */
1102+
#define ABD_ITER_COMPOUND_PAGES
1103+
1104+
#ifdef ABD_ITER_COMPOUND_PAGES
10971105
#define ABD_ITER_PAGE_SIZE(page) \
10981106
(PageCompound(page) ? page_size(page) : PAGESIZE)
10991107
#else
1100-
#undef ABD_ITER_COMPOUND_PAGES
11011108
#define ABD_ITER_PAGE_SIZE(page) (PAGESIZE)
11021109
#endif
11031110

0 commit comments

Comments
 (0)