linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Ira Weiny <ira.weiny@intel.com>
To: Chaitanya Kulkarni <Chaitanya.Kulkarni@wdc.com>
Cc: Andrew Morton <akpm@linux-foundation.org>,
	"clm@fb.com" <clm@fb.com>,
	"josef@toxicpanda.com" <josef@toxicpanda.com>,
	"dsterba@suse.com" <dsterba@suse.com>,
	Boris Pismenny <borisp@mellanox.com>,
	Or Gerlitz <gerlitz.or@gmail.com>,
	Dave Hansen <dave.hansen@intel.com>,
	Matthew Wilcox <willy@infradead.org>,
	"hch@infradead.org" <hch@infradead.org>,
	Dan Williams <dan.j.williams@intel.com>,
	Al Viro <viro@zeniv.linux.org.uk>,
	Eric Biggers <ebiggers@kernel.org>,
	"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>,
	"linux-fsdevel@vger.kernel.org" <linux-fsdevel@vger.kernel.org>
Subject: Re: [PATCH 1/4] mm/highmem: Lift memcpy_[to|from]_page to core
Date: Sun, 7 Feb 2021 19:13:24 -0800	[thread overview]
Message-ID: <20210208031324.GE5033@iweiny-DESK2.sc.intel.com> (raw)
In-Reply-To: <BYAPR04MB49655E5BDB24A108FEFFE9C486B09@BYAPR04MB4965.namprd04.prod.outlook.com>

On Sun, Feb 07, 2021 at 01:46:47AM +0000, Chaitanya Kulkarni wrote:
> On 2/5/21 18:35, ira.weiny@intel.com wrote:
> > +static inline void memmove_page(struct page *dst_page, size_t dst_off,
> > +			       struct page *src_page, size_t src_off,
> > +			       size_t len)
> > +{
> > +	char *dst = kmap_local_page(dst_page);
> > +	char *src = kmap_local_page(src_page);
> > +
> > +	BUG_ON(dst_off + len > PAGE_SIZE || src_off + len > PAGE_SIZE);
> > +	memmove(dst + dst_off, src + src_off, len);
> > +	kunmap_local(src);
> > +	kunmap_local(dst);
> > +}
> > +
> > +static inline void memcpy_from_page(char *to, struct page *page, size_t offset, size_t len)
> How about following ?
> static inline void memcpy_from_page(char *to, struct page *page, size_t
> offset,
>                                     size_t len)  

It is an easy change and It is up to Andrew.  But I thought we were making the
line length limit longer now.

Ira

> > +{
> > +	char *from = kmap_local_page(page);
> > +
> > +	BUG_ON(offset + len > PAGE_SIZE);
> > +	memcpy(to, from + offset, len);
> > +	kunmap_local(from);
> > +}
> > +
> > +static inline void memcpy_to_page(struct page *page, size_t offset, const char *from, size_t len)
> How about following ?
> static inline void memcpy_to_page(struct page *page, size_t offset,
>                                   const char *from, size_t len)
> > +{
> > +	char *to = kmap_local_page(page);
> > +
> > +	BUG_ON(offset + len > PAGE_SIZE);
> > +	memcpy(to + offset, from, len);
> > +	kunmap_local(to);
> > +}
> > +
> > +static inline void memset_page(struct page *page, size_t offset, int val, size_t len)
> How about following ?
> static inline void memset_page(struct page *page, size_t offset, int val,
>                                size_t len)  
> > +{
> > +	char *addr = kmap_local_page(page);
> > +
> > +	BUG_ON(offset + len > PAGE_SIZE);
> > +	memset(addr + offset, val, len);
> > +	kunmap_local(addr);
> > +}
> > +

  reply	other threads:[~2021-02-08  3:14 UTC|newest]

Thread overview: 18+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-02-05 23:23 [PATCH 0/4] btrfs: Convert kmaps to core page calls ira.weiny
2021-02-05 23:23 ` [PATCH 1/4] mm/highmem: Lift memcpy_[to|from]_page to core ira.weiny
2021-02-07  1:46   ` Chaitanya Kulkarni
2021-02-08  3:13     ` Ira Weiny [this message]
2021-02-08  4:34       ` Chaitanya Kulkarni
2021-02-05 23:23 ` [PATCH 2/4] fs/btrfs: Use memcpy_[to|from]_page() ira.weiny
2021-02-09 15:14   ` David Sterba
2021-02-05 23:23 ` [PATCH 3/4] fs/btrfs: Use copy_highpage() instead of 2 kmaps() ira.weiny
2021-02-05 23:23 ` [PATCH 4/4] fs/btrfs: Convert to zero_user() ira.weiny
2021-02-09 15:11 ` [PATCH 0/4] btrfs: Convert kmaps to core page calls David Sterba
2021-02-09 17:45   ` Ira Weiny
2021-02-09 19:09   ` Andrew Morton
2021-02-09 20:52     ` Ira Weiny
2021-02-09 21:11       ` Andrew Morton
2021-02-09 21:52         ` Ira Weiny
2021-02-09 21:58           ` Andrew Morton
2021-02-09 22:03             ` Ira Weiny
2021-02-09 22:27               ` Andrew Morton

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=20210208031324.GE5033@iweiny-DESK2.sc.intel.com \
    --to=ira.weiny@intel.com \
    --cc=Chaitanya.Kulkarni@wdc.com \
    --cc=akpm@linux-foundation.org \
    --cc=borisp@mellanox.com \
    --cc=clm@fb.com \
    --cc=dan.j.williams@intel.com \
    --cc=dave.hansen@intel.com \
    --cc=dsterba@suse.com \
    --cc=ebiggers@kernel.org \
    --cc=gerlitz.or@gmail.com \
    --cc=hch@infradead.org \
    --cc=josef@toxicpanda.com \
    --cc=linux-fsdevel@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=viro@zeniv.linux.org.uk \
    --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;
as well as URLs for NNTP newsgroup(s).