Mikulas Patocka
2016-Jul-11 17:22 UTC
[PATCH] virtio: don't warn if we can't allocate indirect sglist
Don't print warning if memory allocation fails. The virtio driver can handle allocation failure (it falls back to direct sglist), so there is no functionality degradation. This warning was observed when swapping to virtio scsi device because there may be not enough free memory during swapping. Signed-off-by: Mikulas Patocka <mpatocka at redhat.com> --- drivers/virtio/virtio_ring.c | 6 ++++++ 1 file changed, 6 insertions(+) Index: linux-4.7-rc7/drivers/virtio/virtio_ring.c ==================================================================--- linux-4.7-rc7.orig/drivers/virtio/virtio_ring.c 2016-05-09 17:45:04.000000000 +0200 +++ linux-4.7-rc7/drivers/virtio/virtio_ring.c 2016-07-11 17:30:20.000000000 +0200 @@ -237,6 +237,12 @@ static struct vring_desc *alloc_indirect */ gfp &= ~__GFP_HIGHMEM; + /* + * Don't warn if the allocation fails, because the driver + * handles allocation failures gracefully. + */ + gfp |= __GFP_NOWARN; + desc = kmalloc(total_sg * sizeof(struct vring_desc), gfp); if (!desc) return NULL;
Christian Borntraeger
2016-Jul-12 07:30 UTC
[PATCH] virtio: don't warn if we can't allocate indirect sglist
On 07/11/2016 07:22 PM, Mikulas Patocka wrote:> Don't print warning if memory allocation fails. The virtio driver can > handle allocation failure (it falls back to direct sglist), so there is > no functionality degradation. > > This warning was observed when swapping to virtio scsi device because > there may be not enough free memory during swapping. > > Signed-off-by: Mikulas Patocka <mpatocka at redhat.com>Reviewed-by: Christian Borntraeger <borntraeger at de.ibm.com>> > --- > drivers/virtio/virtio_ring.c | 6 ++++++ > 1 file changed, 6 insertions(+) > > Index: linux-4.7-rc7/drivers/virtio/virtio_ring.c > ==================================================================> --- linux-4.7-rc7.orig/drivers/virtio/virtio_ring.c 2016-05-09 17:45:04.000000000 +0200 > +++ linux-4.7-rc7/drivers/virtio/virtio_ring.c 2016-07-11 17:30:20.000000000 +0200 > @@ -237,6 +237,12 @@ static struct vring_desc *alloc_indirect > */ > gfp &= ~__GFP_HIGHMEM; > > + /* > + * Don't warn if the allocation fails, because the driver > + * handles allocation failures gracefully. > + */ > + gfp |= __GFP_NOWARN; > + > desc = kmalloc(total_sg * sizeof(struct vring_desc), gfp); > if (!desc) > return NULL; > _______________________________________________ > Virtualization mailing list > Virtualization at lists.linux-foundation.org > https://lists.linuxfoundation.org/mailman/listinfo/virtualization >
Reasonably Related Threads
- [PATCH] virtio: don't warn if we can't allocate indirect sglist
- [PATCH] net: don't use kvzalloc for DMA memory
- [PATCH] net: don't use kvzalloc for DMA memory
- [PATCH] net: don't use kvzalloc for DMA memory
- [PATCH v4] fault-injection: introduce kvmalloc fallback options