Intel-XE Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: Matthew Brost <matthew.brost@intel.com>
To: "Thomas Hellström" <thomas.hellstrom@linux.intel.com>
Cc: <intel-xe@lists.freedesktop.org>,
	Maarten Lankhorst <maarten.lankhorst@linux.intel.com>
Subject: Re: [PATCH 2/2] drm/xe: Don't unnecessarily invoke the OOM killer on multiple binds
Date: Thu, 17 Oct 2024 14:52:36 +0000	[thread overview]
Message-ID: <ZxEktC+9Tb8u+91t@DUT025-TGLU.fm.intel.com> (raw)
In-Reply-To: <20241017144407.91919-3-thomas.hellstrom@linux.intel.com>

On Thu, Oct 17, 2024 at 04:44:07PM +0200, Thomas Hellström wrote:
> Multiple single-ioctl binds can be split up into multiple bind
> ioctls, reducing the memory required to hold the bind array.
> 
> So rather than allowing the OOM killer to be invoked, return
> -ENOMEM or -ENOBUFS to user-space to take corrective action.
> 
> Cc: Maarten Lankhorst <maarten.lankhorst@linux.intel.com>

Reviewed-by: Matthew Brost <matthew.brost@intel.com>

> Link: https://gitlab.freedesktop.org/drm/xe/kernel/-/issues/2701
> Signed-off-by: Thomas Hellström <thomas.hellstrom@linux.intel.com>
> ---
>  drivers/gpu/drm/xe/xe_vm.c | 8 ++++----
>  1 file changed, 4 insertions(+), 4 deletions(-)
> 
> diff --git a/drivers/gpu/drm/xe/xe_vm.c b/drivers/gpu/drm/xe/xe_vm.c
> index c99380271de6..0142b4daf714 100644
> --- a/drivers/gpu/drm/xe/xe_vm.c
> +++ b/drivers/gpu/drm/xe/xe_vm.c
> @@ -733,7 +733,7 @@ static int xe_vma_ops_alloc(struct xe_vma_ops *vops, bool array_of_binds)
>  		vops->pt_update_ops[i].ops =
>  			kmalloc_array(vops->pt_update_ops[i].num_ops,
>  				      sizeof(*vops->pt_update_ops[i].ops),
> -				      GFP_KERNEL);
> +				      GFP_KERNEL | __GFP_RETRY_MAYFAIL);
>  		if (!vops->pt_update_ops[i].ops)
>  			return array_of_binds ? -ENOBUFS : -ENOMEM;
>  	}
> @@ -2733,7 +2733,7 @@ static int vm_bind_ioctl_check_args(struct xe_device *xe,
>  
>  		*bind_ops = kvmalloc_array(args->num_binds,
>  					   sizeof(struct drm_xe_vm_bind_op),
> -					   GFP_KERNEL | __GFP_ACCOUNT);
> +					   GFP_KERNEL | __GFP_ACCOUNT | __GFP_RETRY_MAYFAIL);
>  		if (!*bind_ops)
>  			return args->num_binds > 1 ? -ENOBUFS : -ENOMEM;
>  
> @@ -2973,14 +2973,14 @@ int xe_vm_bind_ioctl(struct drm_device *dev, void *data, struct drm_file *file)
>  
>  	if (args->num_binds) {
>  		bos = kvcalloc(args->num_binds, sizeof(*bos),
> -			       GFP_KERNEL | __GFP_ACCOUNT);
> +			       GFP_KERNEL | __GFP_ACCOUNT | __GFP_RETRY_MAYFAIL);
>  		if (!bos) {
>  			err = -ENOMEM;
>  			goto release_vm_lock;
>  		}
>  
>  		ops = kvcalloc(args->num_binds, sizeof(*ops),
> -			       GFP_KERNEL | __GFP_ACCOUNT);
> +			       GFP_KERNEL | __GFP_ACCOUNT | __GFP_RETRY_MAYFAIL);
>  		if (!ops) {
>  			err = -ENOMEM;
>  			goto release_vm_lock;
> -- 
> 2.46.0
> 

  reply	other threads:[~2024-10-17 14:53 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-10-17 14:44 [PATCH 0/2] drm/xe: Avoid unnecessary OOM kills Thomas Hellström
2024-10-17 14:44 ` [PATCH 1/2] drm/xe: Avoid the OOM killer on buffer object memory allocation Thomas Hellström
2024-10-17 14:55   ` Matthew Brost
2024-10-17 14:44 ` [PATCH 2/2] drm/xe: Don't unnecessarily invoke the OOM killer on multiple binds Thomas Hellström
2024-10-17 14:52   ` Matthew Brost [this message]
2024-10-17 15:08 ` ✓ CI.Patch_applied: success for drm/xe: Avoid unnecessary OOM kills Patchwork
2024-10-17 15:08 ` ✓ CI.checkpatch: " Patchwork
2024-10-17 15:09 ` ✓ CI.KUnit: " Patchwork
2024-10-17 15:21 ` ✓ CI.Build: " Patchwork
2024-10-17 15:23 ` ✓ CI.Hooks: " Patchwork
2024-10-17 15:24 ` ✓ CI.checksparse: " Patchwork
2024-10-17 15:48 ` ✓ CI.BAT: " Patchwork
2024-10-18  4:39 ` ✗ CI.FULL: failure " Patchwork

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=ZxEktC+9Tb8u+91t@DUT025-TGLU.fm.intel.com \
    --to=matthew.brost@intel.com \
    --cc=intel-xe@lists.freedesktop.org \
    --cc=maarten.lankhorst@linux.intel.com \
    --cc=thomas.hellstrom@linux.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