From: Lorenzo Bianconi <lorenzo.bianconi@redhat.com>
To: Stanislaw Gruszka <sgruszka@redhat.com>
Cc: Felix Fietkau <nbd@nbd.name>, linux-wireless@vger.kernel.org
Subject: Re: [RFC 2/2] mt76: make frag_cache global per cpu structure
Date: Wed, 3 Oct 2018 11:38:54 +0200 [thread overview]
Message-ID: <20181003093853.GC27279@localhost.localdomain> (raw)
In-Reply-To: <1538558230-16576-2-git-send-email-sgruszka@redhat.com>
> +static DEFINE_PER_CPU(struct page_frag_cache, mt76_frag_cache);
> +
> +void *mt76_alloc_frag(unsigned int fragsz)
> +{
> + struct page_frag_cache *fc;
> + unsigned long flags;
> + void *data;
> +
> + local_irq_save(flags);
I like this approach since we will avoid a cache miss for the spinlock :)
Do we still need to disable local_irq here since (not considering fw upload)
I guess there is no contention for mt76_frag_cache
Regards,
Lorenzo
> + fc = this_cpu_ptr(&mt76_frag_cache);
> + data = page_frag_alloc(fc, fragsz, GFP_ATOMIC);
> + local_irq_restore(flags);
> + return data;
> +}
> +EXPORT_SYMBOL_GPL(mt76_alloc_frag);
> +
> MODULE_LICENSE("Dual BSD/GPL");
> diff --git a/drivers/net/wireless/mediatek/mt76/util.h b/drivers/net/wireless/mediatek/mt76/util.h
> index 018d475504a2..6cb6c0e993c4 100644
> --- a/drivers/net/wireless/mediatek/mt76/util.h
> +++ b/drivers/net/wireless/mediatek/mt76/util.h
> @@ -41,4 +41,5 @@ mt76_skb_set_moredata(struct sk_buff *skb, bool enable)
> hdr->frame_control &= ~cpu_to_le16(IEEE80211_FCTL_MOREDATA);
> }
>
> +void *mt76_alloc_frag(unsigned int fragsz);
> #endif
> --
> 2.7.5
>
next prev parent reply other threads:[~2018-10-03 9:39 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-10-03 9:17 [RFC 1/2] mt76: remove rx_page_lock Stanislaw Gruszka
2018-10-03 9:17 ` [RFC 2/2] mt76: make frag_cache global per cpu structure Stanislaw Gruszka
2018-10-03 9:38 ` Lorenzo Bianconi [this message]
2018-10-03 10:22 ` Stanislaw Gruszka
2018-10-03 10:50 ` Felix Fietkau
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=20181003093853.GC27279@localhost.localdomain \
--to=lorenzo.bianconi@redhat.com \
--cc=linux-wireless@vger.kernel.org \
--cc=nbd@nbd.name \
--cc=sgruszka@redhat.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 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.