All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] virtio: Do not drop __GFP_HIGH in alloc_indirect
@ 2015-12-01 14:32 Michal Hocko
  2015-12-01 16:17   ` Will Deacon
                   ` (2 more replies)
  0 siblings, 3 replies; 6+ messages in thread
From: Michal Hocko @ 2015-12-01 14:32 UTC (permalink / raw)
  To: Michael S. Tsirkin; +Cc: Will Deacon, virtualization, LKML, Michal Hocko

From: Michal Hocko <mhocko@suse.com>

b92b1b89a33c ("virtio: force vring descriptors to be allocated from
lowmem") tried to exclude highmem pages for descriptors so it cleared
__GFP_HIGHMEM from a given gfp mask. The patch also cleared __GFP_HIGH
which doesn't make much sense for this fix because __GFP_HIGH only
controls access to memory reserves and it doesn't have any influence
on the zone selection. Some of the call paths use GFP_ATOMIC and
dropping __GFP_HIGH will reduce their changes for success because the
lack of access to memory reserves.

Signed-off-by: Michal Hocko <mhocko@suse.com>
---
Hi,
I have stumbled over this code while looking at other issue [1]. I think
that using __GFP_HIGH simply got there because of its confusing name. It
doesn't have anything to do with the highmem zone.

The patch is based on the current linux-next. 

I think that clearing __GFP_HIGHMEM is bogus in the current code because
all code paths either use GFP_KERNEL or GFP_ATOMIC and those do not fall
back to the highmem zone but I have kept it because clearing the flag
cannot be harmful.

[1] http://lkml.kernel.org/r/87h9k4kzcv.fsf%40yhuang-dev.intel.com

 drivers/virtio/virtio_ring.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/virtio/virtio_ring.c b/drivers/virtio/virtio_ring.c
index 14e7ce9b3e96..734de927c89d 100644
--- a/drivers/virtio/virtio_ring.c
+++ b/drivers/virtio/virtio_ring.c
@@ -110,7 +110,7 @@ static struct vring_desc *alloc_indirect(struct virtqueue *_vq,
 	 * otherwise virt_to_phys will give us bogus addresses in the
 	 * virtqueue.
 	 */
-	gfp &= ~(__GFP_HIGHMEM | __GFP_HIGH);
+	gfp &= ~__GFP_HIGHMEM;
 
 	desc = kmalloc(total_sg * sizeof(struct vring_desc), gfp);
 	if (!desc)
-- 
2.6.2


^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH] virtio: Do not drop __GFP_HIGH in alloc_indirect
  2015-12-01 14:32 [PATCH] virtio: Do not drop __GFP_HIGH in alloc_indirect Michal Hocko
@ 2015-12-01 16:17   ` Will Deacon
  2015-12-07 11:29 ` Mel Gorman
  2015-12-07 11:29 ` Mel Gorman
  2 siblings, 0 replies; 6+ messages in thread
From: Will Deacon @ 2015-12-01 16:17 UTC (permalink / raw)
  To: Michal Hocko; +Cc: Michael S. Tsirkin, virtualization, LKML, Michal Hocko

On Tue, Dec 01, 2015 at 03:32:49PM +0100, Michal Hocko wrote:
> From: Michal Hocko <mhocko@suse.com>
> 
> b92b1b89a33c ("virtio: force vring descriptors to be allocated from
> lowmem") tried to exclude highmem pages for descriptors so it cleared
> __GFP_HIGHMEM from a given gfp mask. The patch also cleared __GFP_HIGH
> which doesn't make much sense for this fix because __GFP_HIGH only
> controls access to memory reserves and it doesn't have any influence
> on the zone selection. Some of the call paths use GFP_ATOMIC and
> dropping __GFP_HIGH will reduce their changes for success because the
> lack of access to memory reserves.
> 
> Signed-off-by: Michal Hocko <mhocko@suse.com>
> ---
> Hi,
> I have stumbled over this code while looking at other issue [1]. I think
> that using __GFP_HIGH simply got there because of its confusing name. It
> doesn't have anything to do with the highmem zone.
> 
> The patch is based on the current linux-next. 
> 
> I think that clearing __GFP_HIGHMEM is bogus in the current code because
> all code paths either use GFP_KERNEL or GFP_ATOMIC and those do not fall
> back to the highmem zone but I have kept it because clearing the flag
> cannot be harmful.
> 
> [1] http://lkml.kernel.org/r/87h9k4kzcv.fsf%40yhuang-dev.intel.com
> 
>  drivers/virtio/virtio_ring.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)

Thanks for cleaning this up:

Acked-by: Will Deacon <will.deacon@arm.com>

Will

> diff --git a/drivers/virtio/virtio_ring.c b/drivers/virtio/virtio_ring.c
> index 14e7ce9b3e96..734de927c89d 100644
> --- a/drivers/virtio/virtio_ring.c
> +++ b/drivers/virtio/virtio_ring.c
> @@ -110,7 +110,7 @@ static struct vring_desc *alloc_indirect(struct virtqueue *_vq,
>  	 * otherwise virt_to_phys will give us bogus addresses in the
>  	 * virtqueue.
>  	 */
> -	gfp &= ~(__GFP_HIGHMEM | __GFP_HIGH);
> +	gfp &= ~__GFP_HIGHMEM;
>  
>  	desc = kmalloc(total_sg * sizeof(struct vring_desc), gfp);
>  	if (!desc)
> -- 
> 2.6.2
> 

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH] virtio: Do not drop __GFP_HIGH in alloc_indirect
@ 2015-12-01 16:17   ` Will Deacon
  0 siblings, 0 replies; 6+ messages in thread
From: Will Deacon @ 2015-12-01 16:17 UTC (permalink / raw)
  To: Michal Hocko; +Cc: virtualization, Michal Hocko, LKML, Michael S. Tsirkin

On Tue, Dec 01, 2015 at 03:32:49PM +0100, Michal Hocko wrote:
> From: Michal Hocko <mhocko@suse.com>
> 
> b92b1b89a33c ("virtio: force vring descriptors to be allocated from
> lowmem") tried to exclude highmem pages for descriptors so it cleared
> __GFP_HIGHMEM from a given gfp mask. The patch also cleared __GFP_HIGH
> which doesn't make much sense for this fix because __GFP_HIGH only
> controls access to memory reserves and it doesn't have any influence
> on the zone selection. Some of the call paths use GFP_ATOMIC and
> dropping __GFP_HIGH will reduce their changes for success because the
> lack of access to memory reserves.
> 
> Signed-off-by: Michal Hocko <mhocko@suse.com>
> ---
> Hi,
> I have stumbled over this code while looking at other issue [1]. I think
> that using __GFP_HIGH simply got there because of its confusing name. It
> doesn't have anything to do with the highmem zone.
> 
> The patch is based on the current linux-next. 
> 
> I think that clearing __GFP_HIGHMEM is bogus in the current code because
> all code paths either use GFP_KERNEL or GFP_ATOMIC and those do not fall
> back to the highmem zone but I have kept it because clearing the flag
> cannot be harmful.
> 
> [1] http://lkml.kernel.org/r/87h9k4kzcv.fsf%40yhuang-dev.intel.com
> 
>  drivers/virtio/virtio_ring.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)

Thanks for cleaning this up:

Acked-by: Will Deacon <will.deacon@arm.com>

Will

> diff --git a/drivers/virtio/virtio_ring.c b/drivers/virtio/virtio_ring.c
> index 14e7ce9b3e96..734de927c89d 100644
> --- a/drivers/virtio/virtio_ring.c
> +++ b/drivers/virtio/virtio_ring.c
> @@ -110,7 +110,7 @@ static struct vring_desc *alloc_indirect(struct virtqueue *_vq,
>  	 * otherwise virt_to_phys will give us bogus addresses in the
>  	 * virtqueue.
>  	 */
> -	gfp &= ~(__GFP_HIGHMEM | __GFP_HIGH);
> +	gfp &= ~__GFP_HIGHMEM;
>  
>  	desc = kmalloc(total_sg * sizeof(struct vring_desc), gfp);
>  	if (!desc)
> -- 
> 2.6.2
> 

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH] virtio: Do not drop __GFP_HIGH in alloc_indirect
  2015-12-01 14:32 [PATCH] virtio: Do not drop __GFP_HIGH in alloc_indirect Michal Hocko
  2015-12-01 16:17   ` Will Deacon
@ 2015-12-07 11:29 ` Mel Gorman
  2015-12-07 11:29 ` Mel Gorman
  2 siblings, 0 replies; 6+ messages in thread
From: Mel Gorman @ 2015-12-07 11:29 UTC (permalink / raw)
  To: Michal Hocko
  Cc: Michael S. Tsirkin, Will Deacon, Huang, Ying, virtualization,
	LKML, Michal Hocko

On Tue, Dec 01, 2015 at 03:32:49PM +0100, Michal Hocko wrote:
> From: Michal Hocko <mhocko@suse.com>
> 
> b92b1b89a33c ("virtio: force vring descriptors to be allocated from
> lowmem") tried to exclude highmem pages for descriptors so it cleared
> __GFP_HIGHMEM from a given gfp mask. The patch also cleared __GFP_HIGH
> which doesn't make much sense for this fix because __GFP_HIGH only
> controls access to memory reserves and it doesn't have any influence
> on the zone selection. Some of the call paths use GFP_ATOMIC and
> dropping __GFP_HIGH will reduce their changes for success because the
> lack of access to memory reserves.
> 
> Signed-off-by: Michal Hocko <mhocko@suse.com>

Reviewed-by: Mel Gorman <mgorman@techsingularity.net>

It also has been tested by Ying Huang and found to have fixed a page
allocation failure problem in 4.4-rc3 in the Intel 0-day testing
infrastructure.

-- 
Mel Gorman
SUSE Labs

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH] virtio: Do not drop __GFP_HIGH in alloc_indirect
  2015-12-01 14:32 [PATCH] virtio: Do not drop __GFP_HIGH in alloc_indirect Michal Hocko
  2015-12-01 16:17   ` Will Deacon
  2015-12-07 11:29 ` Mel Gorman
@ 2015-12-07 11:29 ` Mel Gorman
  2 siblings, 0 replies; 6+ messages in thread
From: Mel Gorman @ 2015-12-07 11:29 UTC (permalink / raw)
  To: Michal Hocko
  Cc: Michal Hocko, Michael S. Tsirkin, Huang, Ying, Will Deacon, LKML,
	virtualization

On Tue, Dec 01, 2015 at 03:32:49PM +0100, Michal Hocko wrote:
> From: Michal Hocko <mhocko@suse.com>
> 
> b92b1b89a33c ("virtio: force vring descriptors to be allocated from
> lowmem") tried to exclude highmem pages for descriptors so it cleared
> __GFP_HIGHMEM from a given gfp mask. The patch also cleared __GFP_HIGH
> which doesn't make much sense for this fix because __GFP_HIGH only
> controls access to memory reserves and it doesn't have any influence
> on the zone selection. Some of the call paths use GFP_ATOMIC and
> dropping __GFP_HIGH will reduce their changes for success because the
> lack of access to memory reserves.
> 
> Signed-off-by: Michal Hocko <mhocko@suse.com>

Reviewed-by: Mel Gorman <mgorman@techsingularity.net>

It also has been tested by Ying Huang and found to have fixed a page
allocation failure problem in 4.4-rc3 in the Intel 0-day testing
infrastructure.

-- 
Mel Gorman
SUSE Labs

^ permalink raw reply	[flat|nested] 6+ messages in thread

* [PATCH] virtio: Do not drop __GFP_HIGH in alloc_indirect
@ 2015-12-01 14:32 Michal Hocko
  0 siblings, 0 replies; 6+ messages in thread
From: Michal Hocko @ 2015-12-01 14:32 UTC (permalink / raw)
  To: Michael S. Tsirkin; +Cc: Michal Hocko, Will Deacon, LKML, virtualization

From: Michal Hocko <mhocko@suse.com>

b92b1b89a33c ("virtio: force vring descriptors to be allocated from
lowmem") tried to exclude highmem pages for descriptors so it cleared
__GFP_HIGHMEM from a given gfp mask. The patch also cleared __GFP_HIGH
which doesn't make much sense for this fix because __GFP_HIGH only
controls access to memory reserves and it doesn't have any influence
on the zone selection. Some of the call paths use GFP_ATOMIC and
dropping __GFP_HIGH will reduce their changes for success because the
lack of access to memory reserves.

Signed-off-by: Michal Hocko <mhocko@suse.com>
---
Hi,
I have stumbled over this code while looking at other issue [1]. I think
that using __GFP_HIGH simply got there because of its confusing name. It
doesn't have anything to do with the highmem zone.

The patch is based on the current linux-next. 

I think that clearing __GFP_HIGHMEM is bogus in the current code because
all code paths either use GFP_KERNEL or GFP_ATOMIC and those do not fall
back to the highmem zone but I have kept it because clearing the flag
cannot be harmful.

[1] http://lkml.kernel.org/r/87h9k4kzcv.fsf%40yhuang-dev.intel.com

 drivers/virtio/virtio_ring.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/virtio/virtio_ring.c b/drivers/virtio/virtio_ring.c
index 14e7ce9b3e96..734de927c89d 100644
--- a/drivers/virtio/virtio_ring.c
+++ b/drivers/virtio/virtio_ring.c
@@ -110,7 +110,7 @@ static struct vring_desc *alloc_indirect(struct virtqueue *_vq,
 	 * otherwise virt_to_phys will give us bogus addresses in the
 	 * virtqueue.
 	 */
-	gfp &= ~(__GFP_HIGHMEM | __GFP_HIGH);
+	gfp &= ~__GFP_HIGHMEM;
 
 	desc = kmalloc(total_sg * sizeof(struct vring_desc), gfp);
 	if (!desc)
-- 
2.6.2

^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2015-12-07 11:29 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-12-01 14:32 [PATCH] virtio: Do not drop __GFP_HIGH in alloc_indirect Michal Hocko
2015-12-01 16:17 ` Will Deacon
2015-12-01 16:17   ` Will Deacon
2015-12-07 11:29 ` Mel Gorman
2015-12-07 11:29 ` Mel Gorman
  -- strict thread matches above, loose matches on Subject: below --
2015-12-01 14:32 Michal Hocko

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.