public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Gao Xiang <hsiangkao@linux.alibaba.com>
To: Yangtao Li <frank.li@vivo.com>, tytso@mit.edu, adilger.kernel@dilger.ca
Cc: linux-ext4@vger.kernel.org, linux-kernel@vger.kernel.org,
	viro@zeniv.linux.org.uk, linux-erofs@lists.ozlabs.org
Subject: Re: [PATCH] ext4: convert to DIV_ROUND_UP() in mpage_process_page_bufs()
Date: Fri, 10 Mar 2023 14:37:11 +0800	[thread overview]
Message-ID: <85434b6a-e7bd-d0c0-654f-233e56112cd0@linux.alibaba.com> (raw)
In-Reply-To: <b47f5003-c7ad-da27-dab6-077f57aaae18@linux.alibaba.com>



On 2023/3/10 14:35, Gao Xiang wrote:
> 
> 
> On 2023/3/10 14:27, Yangtao Li wrote:
>>> Please don't do this.  This makes the code compile down to a division, which is
>>> far less efficient.  I've verified this by checking the assembly generated.
>>
>> How much is the performance impact? So should the following be modified as shift operations as well?
>>
>> fs/erofs/namei.c:92:    int head = 0, back = DIV_ROUND_UP(dir->i_size, EROFS_BLKSIZ) - 1;
>> fs/erofs/zmap.c:252:    const unsigned int totalidx = DIV_ROUND_UP(inode->i_size, EROFS_BLKSIZ);
>> fs/erofs/decompressor.c:14:#define LZ4_MAX_DISTANCE_PAGES       (DIV_ROUND_UP(LZ4_DISTANCE_MAX, PAGE_SIZE) + 1)
>> fs/erofs/decompressor.c:56:                                     DIV_ROUND_UP(distance, PAGE_SIZE) + 1 :
>> fs/erofs/decompressor.c:70:     unsigned long bounced[DIV_ROUND_UP(LZ4_MAX_DISTANCE_PAGES,
>> fs/erofs/data.c:84:     nblocks = DIV_ROUND_UP(inode->i_size, EROFS_BLKSIZ);
> 
> Please stop taking EROFS as example on ext4 patches
> and they will all be changed due to subpage support.

Here EROFS_BLKSIZ == PAGE_SIZE is a constant, so no difference
to use shift or division.

> 
>>
>> Thx,
>> Yangtao

  reply	other threads:[~2023-03-10  6:37 UTC|newest]

Thread overview: 18+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-03-10  6:07 [PATCH] ext4: convert to DIV_ROUND_UP() in mpage_process_page_bufs() Yangtao Li
2023-03-10  6:17 ` Eric Biggers
2023-03-10  6:27   ` Yangtao Li
2023-03-10  6:35     ` Gao Xiang
2023-03-10  6:37       ` Gao Xiang [this message]
2023-03-10  6:41     ` Eric Biggers
2023-03-10  6:37   ` Al Viro
2023-03-10  6:43     ` Al Viro
2023-03-10  6:43     ` Eric Biggers
2023-03-10  6:46       ` Al Viro
2023-03-10  6:54         ` Eric Biggers
2023-03-10  7:05           ` Al Viro
2023-03-10  7:12             ` Al Viro
2023-03-10 21:47               ` Eric Biggers
2023-03-10 19:07 ` kernel test robot
2023-03-10 19:38 ` kernel test robot
2023-03-10 23:21 ` Theodore Ts'o
2023-03-13  9:25   ` David Laight

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=85434b6a-e7bd-d0c0-654f-233e56112cd0@linux.alibaba.com \
    --to=hsiangkao@linux.alibaba.com \
    --cc=adilger.kernel@dilger.ca \
    --cc=frank.li@vivo.com \
    --cc=linux-erofs@lists.ozlabs.org \
    --cc=linux-ext4@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=tytso@mit.edu \
    --cc=viro@zeniv.linux.org.uk \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox