From: "Ma, Jianpeng" <jianpeng.ma@intel.com>
To: Coly Li <colyli@suse.de>, "Ren, Qiaowei" <qiaowei.ren@intel.com>
Cc: "linux-bcache@vger.kernel.org" <linux-bcache@vger.kernel.org>
Subject: RE: [bch-nvm-pages v7 3/6] bcache: initialization of the buddy
Date: Tue, 30 Mar 2021 02:13:14 +0000 [thread overview]
Message-ID: <BN7PR11MB2609D64067A97CDAF31FD6D4FD7D9@BN7PR11MB2609.namprd11.prod.outlook.com> (raw)
In-Reply-To: <e52b3a34-b394-0d16-56b9-edb1e5ba9933@suse.de>
> -----Original Message-----
> From: Coly Li <colyli@suse.de>
> Sent: Monday, March 29, 2021 7:10 PM
> To: Ren, Qiaowei <qiaowei.ren@intel.com>; Ma, Jianpeng
> <jianpeng.ma@intel.com>
> Cc: linux-bcache@vger.kernel.org
> Subject: Re: [bch-nvm-pages v7 3/6] bcache: initialization of the buddy
>
> On 3/17/21 11:10 PM, Qiaowei Ren wrote:
> > From: Jianpeng Ma <jianpeng.ma@intel.com>
> >
> > This nvm pages allocator will implement the simple buddy to manage the
> > nvm address space. This patch initializes this buddy for new namespace.
> >
> > the unit of alloc/free of the buddy is page. DAX device has their
> > struct page(in dram or PMEM).
> >
> > struct { /* ZONE_DEVICE pages */
> > /** @pgmap: Points to the hosting device page map. */
> > struct dev_pagemap *pgmap;
> > void *zone_device_data;
> > /*
> > * ZONE_DEVICE private pages are counted as being
> > * mapped so the next 3 words hold the mapping, index,
> > * and private fields from the source anonymous or
> > * page cache page while the page is migrated to device
> > * private memory.
> > * ZONE_DEVICE MEMORY_DEVICE_FS_DAX pages also
> > * use the mapping, index, and private fields when
> > * pmem backed DAX files are mapped.
> > */
> > };
> >
> > ZONE_DEVICE pages only use pgmap. Other 4 words[16/32 bytes] don't use.
> > So the second/third word will be used as 'struct list_head ' which
> > list in buddy. The fourth word(that is normal struct page::index)
> > store pgoff which the page-offset in the dax device. And the fifth
> > word (that is normal struct page::private) store order of buddy.
> > page_type will be used to store buddy flags.
> >
> > Signed-off-by: Jianpeng Ma <jianpeng.ma@intel.com>
> > Co-authored-by: Qiaowei Ren <qiaowei.ren@intel.com>
> > ---
> > drivers/md/bcache/nvm-pages.c | 142
> +++++++++++++++++++++++++++++++-
> > drivers/md/bcache/nvm-pages.h | 6 ++
> > include/uapi/linux/bcache-nvm.h | 8 ++
> > 3 files changed, 152 insertions(+), 4 deletions(-)
> >
> > diff --git a/drivers/md/bcache/nvm-pages.c
> > b/drivers/md/bcache/nvm-pages.c index 9335371c9d91..1f99965920a1
> > 100644
> > --- a/drivers/md/bcache/nvm-pages.c
> > +++ b/drivers/md/bcache/nvm-pages.c
> > @@ -41,6 +41,10 @@ static void release_nvm_namespaces(struct
> bch_nvm_set *nvm_set)
> > for (i = 0; i < nvm_set->total_namespaces_nr; i++) {
> > ns = nvm_set->nss[i];
> > if (ns) {
> > + kvfree(ns->pages_bitmap);
> > + if (ns->pgalloc_recs_bitmap)
> > + bitmap_free(ns->pgalloc_recs_bitmap);
> > +
> > blkdev_put(ns->bdev,
> FMODE_READ|FMODE_WRITE|FMODE_EXEC);
> > kfree(ns);
> > }
> > @@ -55,17 +59,122 @@ static void release_nvm_set(struct bch_nvm_set
> *nvm_set)
> > kfree(nvm_set);
> > }
> >
> > +static struct page *nvm_vaddr_to_page(struct bch_nvm_namespace *ns,
> > +void *addr) {
> > + return virt_to_page(addr);
> > +}
> > +
> > +static void *nvm_pgoff_to_vaddr(struct bch_nvm_namespace *ns,
> pgoff_t
> > +pgoff) {
> > + return ns->kaddr + (pgoff << PAGE_SHIFT); }
> > +
> > +static inline void remove_owner_space(struct bch_nvm_namespace *ns,
> > + pgoff_t pgoff, u32 nr)
> > +{
> > + bitmap_set(ns->pages_bitmap, pgoff, nr); }
> > +
> > static int init_owner_info(struct bch_nvm_namespace *ns) {
> > struct bch_owner_list_head *owner_list_head =
> > ns->sb->owner_list_head;
> > + struct bch_nvm_pgalloc_recs *sys_recs;
> > + int i, j, k, rc = 0;
> >
> > mutex_lock(&only_set->lock);
> > only_set->owner_list_head = owner_list_head;
> > only_set->owner_list_size = owner_list_head->size;
> > only_set->owner_list_used = owner_list_head->used;
> > +
> > + /*remove used space*/
> > + remove_owner_space(ns, 0, ns->pages_offset/ns->page_size);
> > +
> > + sys_recs = ns->kaddr + BCH_NVM_PAGES_SYS_RECS_HEAD_OFFSET;
> > + // suppose no hole in array
>
> We don't use such code comments format, please follow the comments style
> of existing bcache code.
>
> There are also other locations using "//" for code comments, they should be
> modified as well.
>
Got it, I'll modify those wrong formant in the V8.
Thanks!
Jianpeng.
> Thanks.
>
> Coly Li
>
>
> [snipped]
next prev parent reply other threads:[~2021-03-30 2:14 UTC|newest]
Thread overview: 14+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-03-17 15:10 [bch-nvm-pages v7 0/6] nvm page allocator for bcache Qiaowei Ren
2021-03-17 15:10 ` [bch-nvm-pages v7 1/6] bcache: add initial data structures for nvm pages Qiaowei Ren
2021-03-29 5:47 ` Coly Li
2021-03-17 15:10 ` [bch-nvm-pages v7 2/6] bcache: initialize the nvm pages allocator Qiaowei Ren
2021-03-29 5:54 ` Coly Li
2021-04-05 15:14 ` Coly Li
2021-03-17 15:10 ` [bch-nvm-pages v7 3/6] bcache: initialization of the buddy Qiaowei Ren
2021-03-29 11:10 ` Coly Li
2021-03-30 2:13 ` Ma, Jianpeng [this message]
2021-03-17 15:10 ` [bch-nvm-pages v7 4/6] bcache: bch_nvm_alloc_pages() " Qiaowei Ren
2021-03-29 10:01 ` Coly Li
2021-03-17 15:10 ` [bch-nvm-pages v7 5/6] bcache: bch_nvm_free_pages() " Qiaowei Ren
2021-03-17 15:10 ` [bch-nvm-pages v7 6/6] bcache: get allocated pages from specific owner Qiaowei Ren
2021-03-23 13:24 ` [bch-nvm-pages v7 0/6] nvm page allocator for bcache Coly Li
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=BN7PR11MB2609D64067A97CDAF31FD6D4FD7D9@BN7PR11MB2609.namprd11.prod.outlook.com \
--to=jianpeng.ma@intel.com \
--cc=colyli@suse.de \
--cc=linux-bcache@vger.kernel.org \
--cc=qiaowei.ren@intel.com \
/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).