linux-wireless.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: "Toke Høiland-Jørgensen" <toke@redhat.com>
To: Johannes Berg <johannes@sipsolutions.net>,
	linux-wireless@vger.kernel.org
Subject: Re: [PATCH] net/fq_impl: Switch to kvmalloc() for memory allocation
Date: Tue, 05 Nov 2019 16:56:07 +0100	[thread overview]
Message-ID: <8736f2jp0o.fsf@toke.dk> (raw)
In-Reply-To: <0690b548e233fba3758df0ce1eeca1c0803a62c4.camel@sipsolutions.net>

Johannes Berg <johannes@sipsolutions.net> writes:

> On Tue, 2019-11-05 at 16:49 +0100, Toke Høiland-Jørgensen wrote:
>> The FQ implementation used by mac80211 allocates memory using kmalloc(),
>> which can fail; and Johannes reported that this actually happens in
>> practice.
>> 
>> To avoid this, switch the allocation to kvmalloc() instead; this also
>> brings fq_impl in line with all the FQ qdiscs.
>> 
>> Fixes: 557fc4a09803 ("fq: add fair queuing framework")
>> Reported-by: Johannes Berg <johannes@sipsolutions.net>
>> Signed-off-by: Toke Høiland-Jørgensen <toke@redhat.com>
>> ---
>>  include/net/fq_impl.h | 2 +-
>>  1 file changed, 1 insertion(+), 1 deletion(-)
>> 
>> diff --git a/include/net/fq_impl.h b/include/net/fq_impl.h
>> index 107c0d700ed6..d3873db91c71 100644
>> --- a/include/net/fq_impl.h
>> +++ b/include/net/fq_impl.h
>> @@ -313,7 +313,7 @@ static int fq_init(struct fq *fq, int flows_cnt)
>>  	fq->limit = 8192;
>>  	fq->memory_limit = 16 << 20; /* 16 MBytes */
>>  
>> -	fq->flows = kcalloc(fq->flows_cnt, sizeof(fq->flows[0]), GFP_KERNEL);
>> +	fq->flows = kvcalloc(fq->flows_cnt, sizeof(fq->flows[0]), GFP_KERNEL);
>
> You need a corresponding kvfree(), no?

Oh, right, of course; silly me. Guess I was a bit too trigger-happy on
the nice one-character patch ;)

Will send a v2

-Toke


  reply	other threads:[~2019-11-05 15:56 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-11-05 15:49 [PATCH] net/fq_impl: Switch to kvmalloc() for memory allocation Toke Høiland-Jørgensen
2019-11-05 15:51 ` Johannes Berg
2019-11-05 15:56   ` Toke Høiland-Jørgensen [this message]
2019-11-05 15:58     ` Johannes Berg
2019-11-05 16:08       ` Toke Høiland-Jørgensen

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=8736f2jp0o.fsf@toke.dk \
    --to=toke@redhat.com \
    --cc=johannes@sipsolutions.net \
    --cc=linux-wireless@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).