public inbox for [email protected]
 help / color / mirror / Atom feed
From: Jens Axboe <[email protected]>
To: Stefano Garzarella <[email protected]>
Cc: [email protected]
Subject: Re: [PATCH 2/2] io_uring: account locked memory before potential error case
Date: Thu, 6 Aug 2020 07:21:30 -0600	[thread overview]
Message-ID: <[email protected]> (raw)
In-Reply-To: <20200806074231.mlmfbsl4shvvzodm@steredhat>

On 8/6/20 1:42 AM, Stefano Garzarella wrote:
> On Wed, Aug 05, 2020 at 01:02:24PM -0600, Jens Axboe wrote:
>> The tear down path will always unaccount the memory, so ensure that we
>> have accounted it before hitting any of them.
>>
>> Signed-off-by: Jens Axboe <[email protected]>
>> ---
>>  fs/io_uring.c | 16 ++++++++--------
>>  1 file changed, 8 insertions(+), 8 deletions(-)
>>
>> diff --git a/fs/io_uring.c b/fs/io_uring.c
>> index 0d857f7ca507..7c42f63fbb0a 100644
>> --- a/fs/io_uring.c
>> +++ b/fs/io_uring.c
>> @@ -8341,6 +8341,14 @@ static int io_uring_create(unsigned entries, struct io_uring_params *p,
>>  	ctx->user = user;
>>  	ctx->creds = get_current_cred();
>>  
>> +	/*
>> +	 * Account memory _before_ installing the file descriptor. Once
>> +	 * the descriptor is installed, it can get closed at any time.
>> +	 */
> 
> What about update a bit the comment?
> Maybe adding the commit description in this comment.

I updated the comment:

/*
 * Account memory _before_ installing the file descriptor. Once
 * the descriptor is installed, it can get closed at any time. Also
 * do this before hitting the general error path, as ring freeing
 * will un-account as well.
*/

-- 
Jens Axboe


  reply	other threads:[~2020-08-06 17:05 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-08-05 19:02 [PATCH 0/2] io_uring memory accounting fixes Jens Axboe
2020-08-05 19:02 ` [PATCH 1/2] io_uring: set ctx sq/cq entry count earlier Jens Axboe
2020-08-06  7:39   ` Stefano Garzarella
2020-08-06 13:20     ` Jens Axboe
2020-08-05 19:02 ` [PATCH 2/2] io_uring: account locked memory before potential error case Jens Axboe
2020-08-06  7:42   ` Stefano Garzarella
2020-08-06 13:21     ` Jens Axboe [this message]
2020-08-06 13:38       ` Stefano Garzarella
2020-08-06 13:46         ` Jens Axboe

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 \
    [email protected] \
    [email protected] \
    [email protected] \
    [email protected] \
    /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