lkml.org 
[lkml]   [2022]   [May]   [9]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [PATCH 10/15] mm/swap: break the loop if matching device is found
On Mon, 9 May 2022 21:14:11 +0800 Miaohe Lin <linmiaohe@huawei.com> wrote:

> We can break the loop if matching device is found to save some possible
> cpu cycles because there should be only one matching device and there is
> no need to continue if the matching one is already found.
>
> ...
>
> --- a/mm/swapfile.c
> +++ b/mm/swapfile.c
> @@ -1692,6 +1692,8 @@ int swap_type_of(dev_t device, sector_t offset)
> spin_unlock(&swap_lock);
> return type;
> }
> +
> + break;
> }
> }
> spin_unlock(&swap_lock);

Are you sure? If we have two S_ISREG swapfiles on the same device,
don't they have the same sis->bdev?

If not, why bother passing `offset' into this function at all?

\
 
 \ /
  Last update: 2022-05-09 23:17    [W:1.174 / U:0.008 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site