Search Linux Wireless

Re: [RFC 2/2] mt76: make frag_cache global per cpu structure

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



> +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
> 



[Index of Archives]     [Linux Host AP]     [ATH6KL]     [Linux Wireless Personal Area Network]     [Linux Bluetooth]     [Wireless Regulations]     [Linux Netdev]     [Kernel Newbies]     [Linux Kernel]     [IDE]     [Git]     [Netfilter]     [Bugtraq]     [Yosemite Hiking]     [MIPS Linux]     [ARM Linux]     [Linux RAID]

  Powered by Linux