lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <bddd596b-2e8e-42aa-70cc-41583b15c548@huawei.com>
Date:   Wed, 6 May 2020 11:47:40 +0800
From:   "Leizhen (ThunderTown)" <thunder.leizhen@...wei.com>
To:     Matthew Wilcox <willy@...radead.org>
CC:     Minchan Kim <minchan@...nel.org>, Nitin Gupta <ngupta@...are.org>,
        "Sergey Senozhatsky" <sergey.senozhatsky.work@...il.com>,
        Jens Axboe <axboe@...nel.dk>,
        linux-block <linux-block@...r.kernel.org>,
        Andrew Morton <akpm@...ux-foundation.org>,
        linux-mm <linux-mm@...ck.org>, Alasdair Kergon <agk@...hat.com>,
        Mike Snitzer <snitzer@...hat.com>,
        dm-devel <dm-devel@...hat.com>, Song Liu <song@...nel.org>,
        linux-raid <linux-raid@...r.kernel.org>,
        linux-kernel <linux-kernel@...r.kernel.org>
Subject: Re: [PATCH 2/4] mm/swap: use SECTORS_PER_PAGE_SHIFT to clean up code



On 2020/5/6 9:33, Leizhen (ThunderTown) wrote:
> 
> 
> On 2020/5/6 1:25, Matthew Wilcox wrote:
>> On Tue, May 05, 2020 at 07:55:41PM +0800, Zhen Lei wrote:
>>> +++ b/mm/swapfile.c
>>> @@ -177,8 +177,8 @@ static int discard_swap(struct swap_info_struct *si)
>>>  
>>>  	/* Do not discard the swap header page! */
>>>  	se = first_se(si);
>>> -	start_block = (se->start_block + 1) << (PAGE_SHIFT - 9);
>>> -	nr_blocks = ((sector_t)se->nr_pages - 1) << (PAGE_SHIFT - 9);
>>> +	start_block = (se->start_block + 1) << SECTORS_PER_PAGE_SHIFT;
>>> +	nr_blocks = ((sector_t)se->nr_pages - 1) << SECTORS_PER_PAGE_SHIFT;
>>
>> Thinking about this some more, wouldn't this look better?
>>
>> 	start_block = page_sectors(se->start_block + 1);
>> 	nr_block = page_sectors(se->nr_pages - 1);
>>
> 
> OKļ¼ŒThat's fine, it's clearer. And in this way, there won't be more than 80 columns.

Should we rename "page_sectors" to "page_to_sectors"? Because we may need to define
"sectors_to_page" also.

> 
>>
>> .
>>

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ