[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20210208031324.GE5033@iweiny-DESK2.sc.intel.com>
Date: Sun, 7 Feb 2021 19:13:24 -0800
From: Ira Weiny <ira.weiny@...el.com>
To: Chaitanya Kulkarni <Chaitanya.Kulkarni@....com>
Cc: Andrew Morton <akpm@...ux-foundation.org>,
"clm@...com" <clm@...com>,
"josef@...icpanda.com" <josef@...icpanda.com>,
"dsterba@...e.com" <dsterba@...e.com>,
Boris Pismenny <borisp@...lanox.com>,
Or Gerlitz <gerlitz.or@...il.com>,
Dave Hansen <dave.hansen@...el.com>,
Matthew Wilcox <willy@...radead.org>,
"hch@...radead.org" <hch@...radead.org>,
Dan Williams <dan.j.williams@...el.com>,
Al Viro <viro@...iv.linux.org.uk>,
Eric Biggers <ebiggers@...nel.org>,
"linux-kernel@...r.kernel.org" <linux-kernel@...r.kernel.org>,
"linux-fsdevel@...r.kernel.org" <linux-fsdevel@...r.kernel.org>
Subject: Re: [PATCH 1/4] mm/highmem: Lift memcpy_[to|from]_page to core
On Sun, Feb 07, 2021 at 01:46:47AM +0000, Chaitanya Kulkarni wrote:
> On 2/5/21 18:35, ira.weiny@...el.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);
> > +}
> > +
Powered by blists - more mailing lists