Received: by 2002:a25:23cc:0:0:0:0:0 with SMTP id j195csp993466ybj; Tue, 5 May 2020 11:03:16 -0700 (PDT) X-Google-Smtp-Source: APiQypKw62F4eNyTox/N67Olzx9IZejA7LRW3zCrG5o9os32XTHLF2EzHEAPkvfnAO8200bp82vR X-Received: by 2002:a17:906:2410:: with SMTP id z16mr3995894eja.1.1588701796061; Tue, 05 May 2020 11:03:16 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1588701796; cv=none; d=google.com; s=arc-20160816; b=plEz3pCFz7jjpMgv2TtViO3nkbbWJuqzdXylBdjZYNwo8D9R96zcZWL5LhfJxD5beC otrHXjPRm+9RB8YFWYY7EaSxpHuMK5YTI1p4TiweSsjBezvx0PunkeNKlKu9uvy7ha1m qd/DNy99hh3KGfxR/FggVxtkAIsnXZ7YVpdG6D5GiM6/4jwESXcqKFD0VPUceO9AFCCA 25hGY8nplkIGUQU1fcdNVpkJ0iTooODcRdkrt8D6I2mHmyp/QSvYxlbdaLbibkLOV+Ac G9KNIwG7AJxBKKcn1gN1hjaEtBbH1upJRiB1694HUeNVL5EZ1SC0yNdCSO7kPZ35Pzae 5xpQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:in-reply-to:content-disposition :mime-version:references:message-id:subject:cc:to:from:date :dkim-signature; bh=DEdjlKML1R2TvFeUyu3TZMfM3z2W1qbybh/kO8XwJa0=; b=Wi9gf3uDsuXec+wsSjVSKddmzrvcsDQVMeS+nQ/lSC3B+X0L7Uz/OJnvA1OVtL/4sw IjKTyO6XZMT0J1UYUFvfIaw3xJHjXBPwW1NKOxrCQg0T4jNaamF9c+LRPIcq1vQCmLKg atMXZup+gEyqdPsyhLWl9EvuYNn3ZPUlLqkOVrhSpzMItLuKnrG9vBrjt+r33l0XaYL3 7WKZ5vqiezEVYTJk1vRxmCNBPrGpQieelCq7eYVD1VyzRS9J8yPDVFF6Kq0ZcplBMRbf 85/UaSHIjH0wzUILTII9OGXMfkn9bN/uWpph444UqbhamANKbDDplD5+Sdtl07MaeDWu VIaQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@infradead.org header.s=bombadil.20170209 header.b=iJaqA6hb; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id g17si1670056ejm.271.2020.05.05.11.02.50; Tue, 05 May 2020 11:03:16 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=fail header.i=@infradead.org header.s=bombadil.20170209 header.b=iJaqA6hb; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1730648AbgEESBT (ORCPT + 99 others); Tue, 5 May 2020 14:01:19 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:56354 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1730069AbgEESBT (ORCPT ); Tue, 5 May 2020 14:01:19 -0400 Received: from bombadil.infradead.org (bombadil.infradead.org [IPv6:2607:7c80:54:e::133]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 563ACC061A0F; Tue, 5 May 2020 11:01:19 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=bombadil.20170209; h=In-Reply-To:Content-Type:MIME-Version :References:Message-ID:Subject:Cc:To:From:Date:Sender:Reply-To: Content-Transfer-Encoding:Content-ID:Content-Description; bh=DEdjlKML1R2TvFeUyu3TZMfM3z2W1qbybh/kO8XwJa0=; b=iJaqA6hbKDkz2nKamSZxrF5zmm FU7Kvb/wLNIjVOxrESepN4Te0u2LhOfQW2AG0jVLWeiYZAFHJGd/TNgNgEmplaw9g15MBIfN2Vrsh mh4dGkzy3VobdRxXP6YX3xS0+C6I856TKZmIoLGgiQOEkG8yw6r/M7hrk+pcdVurwlowZ6nc+HDru 0Trn7IA/vMr8RHcBpbie88BD5fv6xLaAYvT2wP8RkMsYaHuTsenY6f8P7YBE7WRirJxuJNlvPzgly 8XX5mxtWEwN6aX5kgLl8yAf6BgUZPNuoSVKBuTmHtPiKQhZUKrV8pwSNqd8qdPmtlqfOw0USqeZi+ XR+yIQ0Q==; Received: from willy by bombadil.infradead.org with local (Exim 4.92.3 #3 (Red Hat Linux)) id 1jW1sX-00012x-Mg; Tue, 05 May 2020 18:01:13 +0000 Date: Tue, 5 May 2020 11:01:13 -0700 From: Matthew Wilcox To: antlists Cc: 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 Subject: Re: [PATCH 0/4] eliminate SECTOR related magic numbers and duplicated conversions Message-ID: <20200505180113.GJ16070@bombadil.infradead.org> References: <20200505115543.1660-1-thunder.leizhen@huawei.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Tue, May 05, 2020 at 06:32:36PM +0100, antlists wrote: > 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? They're fully supported already, but Linux defines a sector to be 512 bytes. So we multiply by 8 and divide by 8 a few times unnecessarily, but it's not worth making sector size be a per-device property. Good thought, though.