linux-usb.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Alan Stern <stern@rowland.harvard.edu>
To: gavinli@thegavinli.com
Cc: gregkh@linuxfoundation.org, <linux-usb@vger.kernel.org>,
	Gavin Li <git@thegavinli.com>
Subject: Re: [PATCH] usb: usbfs: only account once for mmap()'ed usb memory usage
Date: Thu, 15 Aug 2019 15:16:47 -0400 (EDT)	[thread overview]
Message-ID: <Pine.LNX.4.44L0.1908151513490.1343-100000@iolanthe.rowland.org> (raw)
In-Reply-To: <20190814212924.10381-1-gavinli@thegavinli.com>

On Wed, 14 Aug 2019 gavinli@thegavinli.com wrote:

> From: Gavin Li <git@thegavinli.com>
> 
> Memory usage for USB memory allocated via mmap() is already accounted
> for at mmap() time; no need to account for it again at submiturb time.
> 
> Signed-off-by: Gavin Li <git@thegavinli.com>
> ---
>  drivers/usb/core/devio.c | 3 ++-
>  1 file changed, 2 insertions(+), 1 deletion(-)
> 
> diff --git a/drivers/usb/core/devio.c b/drivers/usb/core/devio.c
> index bbe9c2edd3e7..9681dd55473b 100644
> --- a/drivers/usb/core/devio.c
> +++ b/drivers/usb/core/devio.c
> @@ -1603,7 +1603,8 @@ static int proc_do_submiturb(struct usb_dev_state *ps, struct usbdevfs_urb *uurb
>  	if (as->usbm)
>  		num_sgs = 0;
>  
> -	u += sizeof(struct async) + sizeof(struct urb) + uurb->buffer_length +
> +	u += sizeof(struct async) + sizeof(struct urb) +
> +	     (as->usbm ? 0 : uurb->buffer_length) +
>  	     num_sgs * sizeof(struct scatterlist);
>  	ret = usbfs_increase_memory_usage(u);
>  	if (ret)
> 

Acked-by: Alan Stern <stern@rowland.harvard.edu>


      parent reply	other threads:[~2019-08-15 19:16 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-08-14 21:29 [PATCH] usb: usbfs: only account once for mmap()'ed usb memory usage gavinli
2019-08-15 12:53 ` Greg KH
2019-08-16  5:51   ` Gavin Li
2019-08-15 19:16 ` Alan Stern [this message]

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=Pine.LNX.4.44L0.1908151513490.1343-100000@iolanthe.rowland.org \
    --to=stern@rowland.harvard.edu \
    --cc=gavinli@thegavinli.com \
    --cc=git@thegavinli.com \
    --cc=gregkh@linuxfoundation.org \
    --cc=linux-usb@vger.kernel.org \
    /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).