Re: [PATCH] xen-blkback: allocate list of pending reqs in small chunks
On 29/04/13 20:37, Konrad Rzeszutek Wilk wrote: > On Fri, Apr 26, 2013 at 03:47:40PM +0100, David Vrabel wrote: >> On 26/04/13 14:45, Roger Pau Monne wrote: >>> Allocate pending requests in smaller chunks instead of allocating them >>> all at the same time. >>> >>> This change also removes the global array of pending_reqs, it is no >>> longer necessay. >>> >>> Variables related to the grant mapping have been grouped into a struct >>> called "grant_page", this allows to allocate them in smaller chunks, >>> and also improves memory locality. >>> >> [...] >>> diff --git a/drivers/block/xen-blkback/xenbus.c >>> b/drivers/block/xen-blkback/xenbus.c >>> index afab208..2841c0f 100644 >>> --- a/drivers/block/xen-blkback/xenbus.c >>> +++ b/drivers/block/xen-blkback/xenbus.c >>> @@ -127,22 +128,53 @@ static struct xen_blkif *xen_blkif_alloc(domid_t >>> domid) >>> blkif->free_pages_num = 0; >>> atomic_set(>persistent_gnt_in_use, 0); >>> >>> - blkif->pending_reqs = kcalloc(XEN_BLKIF_REQS, >>> - sizeof(blkif->pending_reqs[0]), >>> - GFP_KERNEL); >>> - if (!blkif->pending_reqs) { >>> - kmem_cache_free(xen_blkif_cachep, blkif); >>> - return ERR_PTR(-ENOMEM); >>> - } >>> INIT_LIST_HEAD(>pending_free); >>> + >>> + pr_alert("sizeof req: %lu\n", sizeof(*req)); >> >> Stray pr_alert() here. >> >> Looks good otherwise. >> >> Reviewed-by: David Vrabel > > Roger, could you repost it please and also include Tested-by: Sander.. on it > please? Done, see v3. -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
Re: [PATCH] xen-blkback: allocate list of pending reqs in small chunks
On 29/04/13 20:37, Konrad Rzeszutek Wilk wrote: On Fri, Apr 26, 2013 at 03:47:40PM +0100, David Vrabel wrote: On 26/04/13 14:45, Roger Pau Monne wrote: Allocate pending requests in smaller chunks instead of allocating them all at the same time. This change also removes the global array of pending_reqs, it is no longer necessay. Variables related to the grant mapping have been grouped into a struct called grant_page, this allows to allocate them in smaller chunks, and also improves memory locality. [...] diff --git a/drivers/block/xen-blkback/xenbus.c b/drivers/block/xen-blkback/xenbus.c index afab208..2841c0f 100644 --- a/drivers/block/xen-blkback/xenbus.c +++ b/drivers/block/xen-blkback/xenbus.c @@ -127,22 +128,53 @@ static struct xen_blkif *xen_blkif_alloc(domid_t domid) blkif-free_pages_num = 0; atomic_set(blkif-persistent_gnt_in_use, 0); - blkif-pending_reqs = kcalloc(XEN_BLKIF_REQS, - sizeof(blkif-pending_reqs[0]), - GFP_KERNEL); - if (!blkif-pending_reqs) { - kmem_cache_free(xen_blkif_cachep, blkif); - return ERR_PTR(-ENOMEM); - } INIT_LIST_HEAD(blkif-pending_free); + + pr_alert(sizeof req: %lu\n, sizeof(*req)); Stray pr_alert() here. Looks good otherwise. Reviewed-by: David Vrabel david.vra...@citrix.com Roger, could you repost it please and also include Tested-by: Sander.. on it please? Done, see v3. -- To unsubscribe from this list: send the line unsubscribe linux-kernel in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
Re: [PATCH] xen-blkback: allocate list of pending reqs in small chunks
On Fri, Apr 26, 2013 at 03:47:40PM +0100, David Vrabel wrote: > On 26/04/13 14:45, Roger Pau Monne wrote: > > Allocate pending requests in smaller chunks instead of allocating them > > all at the same time. > > > > This change also removes the global array of pending_reqs, it is no > > longer necessay. > > > > Variables related to the grant mapping have been grouped into a struct > > called "grant_page", this allows to allocate them in smaller chunks, > > and also improves memory locality. > > > [...] > > diff --git a/drivers/block/xen-blkback/xenbus.c > > b/drivers/block/xen-blkback/xenbus.c > > index afab208..2841c0f 100644 > > --- a/drivers/block/xen-blkback/xenbus.c > > +++ b/drivers/block/xen-blkback/xenbus.c > > @@ -127,22 +128,53 @@ static struct xen_blkif *xen_blkif_alloc(domid_t > > domid) > > blkif->free_pages_num = 0; > > atomic_set(>persistent_gnt_in_use, 0); > > > > - blkif->pending_reqs = kcalloc(XEN_BLKIF_REQS, > > - sizeof(blkif->pending_reqs[0]), > > - GFP_KERNEL); > > - if (!blkif->pending_reqs) { > > - kmem_cache_free(xen_blkif_cachep, blkif); > > - return ERR_PTR(-ENOMEM); > > - } > > INIT_LIST_HEAD(>pending_free); > > + > > + pr_alert("sizeof req: %lu\n", sizeof(*req)); > > Stray pr_alert() here. > > Looks good otherwise. > > Reviewed-by: David Vrabel Roger, could you repost it please and also include Tested-by: Sander.. on it please? > > David -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
Re: [PATCH] xen-blkback: allocate list of pending reqs in small chunks
On Fri, Apr 26, 2013 at 03:47:40PM +0100, David Vrabel wrote: On 26/04/13 14:45, Roger Pau Monne wrote: Allocate pending requests in smaller chunks instead of allocating them all at the same time. This change also removes the global array of pending_reqs, it is no longer necessay. Variables related to the grant mapping have been grouped into a struct called grant_page, this allows to allocate them in smaller chunks, and also improves memory locality. [...] diff --git a/drivers/block/xen-blkback/xenbus.c b/drivers/block/xen-blkback/xenbus.c index afab208..2841c0f 100644 --- a/drivers/block/xen-blkback/xenbus.c +++ b/drivers/block/xen-blkback/xenbus.c @@ -127,22 +128,53 @@ static struct xen_blkif *xen_blkif_alloc(domid_t domid) blkif-free_pages_num = 0; atomic_set(blkif-persistent_gnt_in_use, 0); - blkif-pending_reqs = kcalloc(XEN_BLKIF_REQS, - sizeof(blkif-pending_reqs[0]), - GFP_KERNEL); - if (!blkif-pending_reqs) { - kmem_cache_free(xen_blkif_cachep, blkif); - return ERR_PTR(-ENOMEM); - } INIT_LIST_HEAD(blkif-pending_free); + + pr_alert(sizeof req: %lu\n, sizeof(*req)); Stray pr_alert() here. Looks good otherwise. Reviewed-by: David Vrabel david.vra...@citrix.com Roger, could you repost it please and also include Tested-by: Sander.. on it please? David -- To unsubscribe from this list: send the line unsubscribe linux-kernel in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
Re: [PATCH] xen-blkback: allocate list of pending reqs in small chunks
On 26/04/13 14:45, Roger Pau Monne wrote: > Allocate pending requests in smaller chunks instead of allocating them > all at the same time. > > This change also removes the global array of pending_reqs, it is no > longer necessay. > > Variables related to the grant mapping have been grouped into a struct > called "grant_page", this allows to allocate them in smaller chunks, > and also improves memory locality. > [...] > diff --git a/drivers/block/xen-blkback/xenbus.c > b/drivers/block/xen-blkback/xenbus.c > index afab208..2841c0f 100644 > --- a/drivers/block/xen-blkback/xenbus.c > +++ b/drivers/block/xen-blkback/xenbus.c > @@ -127,22 +128,53 @@ static struct xen_blkif *xen_blkif_alloc(domid_t domid) > blkif->free_pages_num = 0; > atomic_set(>persistent_gnt_in_use, 0); > > - blkif->pending_reqs = kcalloc(XEN_BLKIF_REQS, > - sizeof(blkif->pending_reqs[0]), > - GFP_KERNEL); > - if (!blkif->pending_reqs) { > - kmem_cache_free(xen_blkif_cachep, blkif); > - return ERR_PTR(-ENOMEM); > - } > INIT_LIST_HEAD(>pending_free); > + > + pr_alert("sizeof req: %lu\n", sizeof(*req)); Stray pr_alert() here. Looks good otherwise. Reviewed-by: David Vrabel David -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
Re: [PATCH] xen-blkback: allocate list of pending reqs in small chunks
On 26/04/13 14:45, Roger Pau Monne wrote: Allocate pending requests in smaller chunks instead of allocating them all at the same time. This change also removes the global array of pending_reqs, it is no longer necessay. Variables related to the grant mapping have been grouped into a struct called grant_page, this allows to allocate them in smaller chunks, and also improves memory locality. [...] diff --git a/drivers/block/xen-blkback/xenbus.c b/drivers/block/xen-blkback/xenbus.c index afab208..2841c0f 100644 --- a/drivers/block/xen-blkback/xenbus.c +++ b/drivers/block/xen-blkback/xenbus.c @@ -127,22 +128,53 @@ static struct xen_blkif *xen_blkif_alloc(domid_t domid) blkif-free_pages_num = 0; atomic_set(blkif-persistent_gnt_in_use, 0); - blkif-pending_reqs = kcalloc(XEN_BLKIF_REQS, - sizeof(blkif-pending_reqs[0]), - GFP_KERNEL); - if (!blkif-pending_reqs) { - kmem_cache_free(xen_blkif_cachep, blkif); - return ERR_PTR(-ENOMEM); - } INIT_LIST_HEAD(blkif-pending_free); + + pr_alert(sizeof req: %lu\n, sizeof(*req)); Stray pr_alert() here. Looks good otherwise. Reviewed-by: David Vrabel david.vra...@citrix.com David -- To unsubscribe from this list: send the line unsubscribe linux-kernel in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/