linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
From: Baolin Wang <baolin.wang@linux.alibaba.com>
To: Kefeng Wang <wangkefeng.wang@huawei.com>,
	akpm@linux-foundation.org, hughd@google.com
Cc: willy@infradead.org, david@redhat.com, linux-mm@kvack.org,
	linux-kernel@vger.kernel.org
Subject: Re: [PATCH 1/2] mm: shmem: update iocb->ki_pos directly to simplify tmpfs read logic
Date: Thu, 17 Oct 2024 10:45:53 +0800	[thread overview]
Message-ID: <646157ce-5aa5-44e7-b3a2-b3d39f83d349@linux.alibaba.com> (raw)
In-Reply-To: <584e60dd-8a3b-46d5-87ec-aa7032d3a572@huawei.com>



On 2024/10/16 20:34, Kefeng Wang wrote:
> 
> 
> On 2024/10/16 18:09, Baolin Wang wrote:
>> Use iocb->ki_pos to check if the read bytes exceeds the file size and to
>> calculate the bytes to be read can help simplify the code logic. 
>> Meanwhile,
>> this is also a preparation for improving tmpfs large folios read 
>> performace
>> in the following patch.
>>
>> Signed-off-by: Baolin Wang <baolin.wang@linux.alibaba.com>
>> ---
>>   mm/shmem.c | 36 ++++++++++++------------------------
>>   1 file changed, 12 insertions(+), 24 deletions(-)
>>
>> diff --git a/mm/shmem.c b/mm/shmem.c
>> index 66eae800ffab..edab02a26aac 100644
>> --- a/mm/shmem.c
>> +++ b/mm/shmem.c
>> @@ -3106,26 +3106,18 @@ static ssize_t shmem_file_read_iter(struct 
>> kiocb *iocb, struct iov_iter *to)
>>       unsigned long offset;
>>       int error = 0;
>>       ssize_t retval = 0;
>> -    loff_t *ppos = &iocb->ki_pos;
>> -    index = *ppos >> PAGE_SHIFT;
>> -    offset = *ppos & ~PAGE_MASK;
>> +    index = iocb->ki_pos >> PAGE_SHIFT;
> 
> index calculate could be moved before shmem_get_folio(), then...

Yes. Will do.


  reply	other threads:[~2024-10-17  2:46 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-10-16 10:09 [PATCH 0/2] Improve the tmpfs large folio read performance Baolin Wang
2024-10-16 10:09 ` [PATCH 1/2] mm: shmem: update iocb->ki_pos directly to simplify tmpfs read logic Baolin Wang
2024-10-16 12:34   ` Kefeng Wang
2024-10-17  2:45     ` Baolin Wang [this message]
2024-10-16 10:09 ` [PATCH 2/2] mm: shmem: improve the tmpfs large folio read performance Baolin Wang
2024-10-16 12:36   ` Kefeng Wang
2024-10-17  2:46     ` Baolin Wang
2024-10-16 15:37   ` Matthew Wilcox
2024-10-16 17:33     ` Yang Shi
2024-10-17  3:25       ` Baolin Wang
2024-10-17 16:48         ` Yang Shi
2024-10-18  1:45           ` Baolin Wang
2024-10-16 11:47 ` [PATCH 0/2] Improve " Kefeng Wang

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=646157ce-5aa5-44e7-b3a2-b3d39f83d349@linux.alibaba.com \
    --to=baolin.wang@linux.alibaba.com \
    --cc=akpm@linux-foundation.org \
    --cc=david@redhat.com \
    --cc=hughd@google.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mm@kvack.org \
    --cc=wangkefeng.wang@huawei.com \
    --cc=willy@infradead.org \
    /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