From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-2.2 required=3.0 tests=HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,USER_AGENT_SANE_1 autolearn=no autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 95AC6C47254 for ; Tue, 5 May 2020 17:32:39 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id 4DC6E206CC for ; Tue, 5 May 2020 17:32:39 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 4DC6E206CC Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=youngman.org.uk Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=owner-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix) id EA5A98E0005; Tue, 5 May 2020 13:32:38 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id E56048E0003; Tue, 5 May 2020 13:32:38 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id D9B808E0005; Tue, 5 May 2020 13:32:38 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0243.hostedemail.com [216.40.44.243]) by kanga.kvack.org (Postfix) with ESMTP id C22C48E0003 for ; Tue, 5 May 2020 13:32:38 -0400 (EDT) Received: from smtpin21.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay01.hostedemail.com (Postfix) with ESMTP id 88837180AD80F for ; Tue, 5 May 2020 17:32:38 +0000 (UTC) X-FDA: 76783359996.21.screw36_8b6d2d58a612c X-HE-Tag: screw36_8b6d2d58a612c X-Filterd-Recvd-Size: 2016 Received: from mail-out-auth1.hosts.co.uk (mail-out-auth1.hosts.co.uk [195.7.255.1]) by imf27.hostedemail.com (Postfix) with ESMTP for ; Tue, 5 May 2020 17:32:37 +0000 (UTC) Received: from [81.153.126.158] (helo=[192.168.1.225]) by smtp.hosts.co.uk with esmtpa (Exim) (envelope-from ) id 1jW1Qq-0006Ej-Em; Tue, 05 May 2020 18:32:36 +0100 Subject: Re: [PATCH 0/4] eliminate SECTOR related magic numbers and duplicated conversions To: Zhen Lei , Minchan Kim , Nitin Gupta , Sergey Senozhatsky , Jens Axboe , linux-block , Andrew Morton , linux-mm , Alasdair Kergon , Mike Snitzer , dm-devel , Song Liu , linux-raid , linux-kernel References: <20200505115543.1660-1-thunder.leizhen@huawei.com> From: antlists Message-ID: Date: Tue, 5 May 2020 18:32:36 +0100 User-Agent: Mozilla/5.0 (Windows NT 10.0; WOW64; rv:68.0) Gecko/20100101 Thunderbird/68.7.0 MIME-Version: 1.0 In-Reply-To: <20200505115543.1660-1-thunder.leizhen@huawei.com> Content-Type: text/plain; charset=utf-8; format=flowed Content-Language: en-GB Content-Transfer-Encoding: 7bit X-Bogosity: Ham, tests=bogofilter, spamicity=0.000005, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: On 05/05/2020 12:55, Zhen Lei wrote: > When I studied the code of mm/swap, I found "1 << (PAGE_SHIFT - 9)" appears > many times. So I try to clean up it. > > 1. Replace "1 << (PAGE_SHIFT - 9)" or similar with SECTORS_PER_PAGE > 2. Replace "PAGE_SHIFT - 9" with SECTORS_PER_PAGE_SHIFT > 3. Replace "9" with SECTOR_SHIFT > 4. Replace "512" with SECTOR_SIZE Naive question - what is happening about 4096-byte sectors? Do we need to forward-plan? Cheers, Wol