mm/swap.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
From: Hongfu Li <lihongfu@kylinos.cn>
The !CONFIG_SWAP stub for swap_cluster_lock() has mismatched prototype:
it has an extra unused irq argument and uses pgoff_t instead of unsigned
long for offset. All callers are under CONFIG_SWAP so the extra parameter
is dead.
Sync the stub signature with the real function.
Fixes: 8578e0c00dcf ("mm, swap: use the swap table for the swap cache and switch API")
Signed-off-by: Hongfu Li <lihongfu@kylinos.cn>
---
mm/swap.h | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/mm/swap.h b/mm/swap.h
index 77d2d14eda42..2c4667662601 100644
--- a/mm/swap.h
+++ b/mm/swap.h
@@ -337,7 +337,7 @@ static inline unsigned int folio_swap_flags(struct folio *folio)
#else /* CONFIG_SWAP */
struct swap_iocb;
static inline struct swap_cluster_info *swap_cluster_lock(
- struct swap_info_struct *si, pgoff_t offset, bool irq)
+ struct swap_info_struct *si, unsigned long offset)
{
return NULL;
}
--
2.54.0
On Thu, Jul 16, 2026 at 4:56 PM Hongfu Li <hongfu.li@linux.dev> wrote:
>
> From: Hongfu Li <lihongfu@kylinos.cn>
>
> The !CONFIG_SWAP stub for swap_cluster_lock() has mismatched prototype:
> it has an extra unused irq argument and uses pgoff_t instead of unsigned
> long for offset. All callers are under CONFIG_SWAP so the extra parameter
> is dead.
>
> Sync the stub signature with the real function.
>
> Fixes: 8578e0c00dcf ("mm, swap: use the swap table for the swap cache and switch API")
> Signed-off-by: Hongfu Li <lihongfu@kylinos.cn>
> ---
> mm/swap.h | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/mm/swap.h b/mm/swap.h
> index 77d2d14eda42..2c4667662601 100644
> --- a/mm/swap.h
> +++ b/mm/swap.h
> @@ -337,7 +337,7 @@ static inline unsigned int folio_swap_flags(struct folio *folio)
> #else /* CONFIG_SWAP */
> struct swap_iocb;
> static inline struct swap_cluster_info *swap_cluster_lock(
> - struct swap_info_struct *si, pgoff_t offset, bool irq)
> + struct swap_info_struct *si, unsigned long offset)
Thanks, nice catch. I didn't see any build failure report, it seems
swap_cluster_lock is never used with !CONFIG_SWAP? In that case we can
just delete this redundant declaration.
在 2026/7/16 17:47, Kairui Song 写道:
> On Thu, Jul 16, 2026 at 4:56 PM Hongfu Li <hongfu.li@linux.dev> wrote:
>> From: Hongfu Li <lihongfu@kylinos.cn>
>>
>> The !CONFIG_SWAP stub for swap_cluster_lock() has mismatched prototype:
>> it has an extra unused irq argument and uses pgoff_t instead of unsigned
>> long for offset. All callers are under CONFIG_SWAP so the extra parameter
>> is dead.
>>
>> Sync the stub signature with the real function.
>>
>> Fixes: 8578e0c00dcf ("mm, swap: use the swap table for the swap cache and switch API")
>> Signed-off-by: Hongfu Li <lihongfu@kylinos.cn>
>> ---
>> mm/swap.h | 2 +-
>> 1 file changed, 1 insertion(+), 1 deletion(-)
>>
>> diff --git a/mm/swap.h b/mm/swap.h
>> index 77d2d14eda42..2c4667662601 100644
>> --- a/mm/swap.h
>> +++ b/mm/swap.h
>> @@ -337,7 +337,7 @@ static inline unsigned int folio_swap_flags(struct folio *folio)
>> #else /* CONFIG_SWAP */
>> struct swap_iocb;
>> static inline struct swap_cluster_info *swap_cluster_lock(
>> - struct swap_info_struct *si, pgoff_t offset, bool irq)
>> + struct swap_info_struct *si, unsigned long offset)
> Thanks, nice catch. I didn't see any build failure report, it seems
> swap_cluster_lock is never used with !CONFIG_SWAP? In that case we can
> just delete this redundant declaration.
Agreed. |swap_cluster_lock| is never referenced under |!CONFIG_SWAP|, so
this
declaration is redundant. I will drop it in v2.
On 07/16/26 at 04:51pm, Hongfu Li wrote:
> From: Hongfu Li <lihongfu@kylinos.cn>
>
> The !CONFIG_SWAP stub for swap_cluster_lock() has mismatched prototype:
> it has an extra unused irq argument and uses pgoff_t instead of unsigned
> long for offset. All callers are under CONFIG_SWAP so the extra parameter
> is dead.
>
> Sync the stub signature with the real function.
>
> Fixes: 8578e0c00dcf ("mm, swap: use the swap table for the swap cache and switch API")
> Signed-off-by: Hongfu Li <lihongfu@kylinos.cn>
> ---
> mm/swap.h | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/mm/swap.h b/mm/swap.h
> index 77d2d14eda42..2c4667662601 100644
> --- a/mm/swap.h
> +++ b/mm/swap.h
> @@ -337,7 +337,7 @@ static inline unsigned int folio_swap_flags(struct folio *folio)
> #else /* CONFIG_SWAP */
> struct swap_iocb;
> static inline struct swap_cluster_info *swap_cluster_lock(
> - struct swap_info_struct *si, pgoff_t offset, bool irq)
> + struct swap_info_struct *si, unsigned long offset)
Good catch.
Reviewed-by: Baoquan He <baoquan.he@linux.dev>
> {
> return NULL;
> }
> --
> 2.54.0
>
© 2016 - 2026 Red Hat, Inc.