linux-wireless.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: David Laight <David.Laight@ACULAB.COM>
To: 'Tony Chuang' <yhchuang@realtek.com>,
	Jian-Hong Pan <jian-hong@endlessm.com>
Cc: Kalle Valo <kvalo@codeaurora.org>,
	"David S . Miller" <davem@davemloft.net>,
	"linux-wireless@vger.kernel.org" <linux-wireless@vger.kernel.org>,
	"netdev@vger.kernel.org" <netdev@vger.kernel.org>,
	"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>,
	"linux@endlessm.com" <linux@endlessm.com>,
	Daniel Drake <drake@endlessm.com>,
	"stable@vger.kernel.org" <stable@vger.kernel.org>
Subject: RE: [PATCH] rtw88/pci: Rearrange the memory usage for skb in RX ISR
Date: Mon, 8 Jul 2019 09:18:28 +0000	[thread overview]
Message-ID: <85e3b48ee6694aa491c7caa73c027e0f@AcuMS.aculab.com> (raw)
In-Reply-To: <F7CD281DE3E379468C6D07993EA72F84D1861B71@RTITMBSVM04.realtek.com.tw>

From: Tony Chuang
> Sent: 08 July 2019 10:00
> > > > @@ -803,25 +812,14 @@ static void rtw_pci_rx_isr(struct rtw_dev
> > *rtwdev,
> > > > struct rtw_pci *rtwpci,
> > > >                       skb_put(skb, pkt_stat.pkt_len);
> > > >                       skb_reserve(skb, pkt_offset);
> > > >
> > > > -                     /* alloc a smaller skb to mac80211 */
> > > > -                     new = dev_alloc_skb(pkt_stat.pkt_len);
> > > > -                     if (!new) {
> > > > -                             new = skb;
> > > > -                     } else {
> > > > -                             skb_put_data(new, skb->data,
> > skb->len);
> > > > -                             dev_kfree_skb_any(skb);
> > > > -                     }
> > >
> > > I am not sure if it's fine to deliver every huge SKB to mac80211.
> > > Because it will then be delivered to TCP/IP stack.
> > > Hence I think either it should be tested to know if the performance
> > > would be impacted or find out a more efficient way to send
> > > smaller SKB to mac80211 stack.
> >
> > I remember network stack only processes the skb with(in) pointers
> > (skb->data) and the skb->len for data part.  It also checks real
> > buffer boundary (head and end) of the skb to prevent memory overflow.
> > Therefore, I think using the original skb is the most efficient way.
> >
> > If I misunderstand something, please point out.
> >
> 
> It means if we still use a huge SKB (~8K) for every RX packet (~1.5K).
> There is about 6.5K not used. And even more if we ping with large packet
> size "eg. $ ping -s 65536", I am not sure if those huge SKBs will eat all of
> the SKB mem pool, and then ping fails.
> 
> BTW, the original design of RTK_PCI_RX_BUF_SIZE to be (8192 + 24) is to
> receive AMSDU packet in one SKB.
> (Could probably enlarge it to RX VHT AMSDU ~11K)

If you allocate 8192+24 the memory allocated will be either 12k or 16k
and the skb truesize set appropriately.
(Probably 16k if dma memory.)
If this is fed into IP it is quite likely that a single byte of data
will end up queued on the socket in 16k of dma-able memory.
The 'truesize' stops this using all the system memory, but it isn't
good for memory usage.

	David

-
Registered Address Lakeside, Bramley Road, Mount Farm, Milton Keynes, MK1 1PT, UK
Registration No: 1397386 (Wales)

  reply	other threads:[~2019-07-08  9:18 UTC|newest]

Thread overview: 23+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-07-08  6:32 [PATCH] rtw88/pci: Rearrange the memory usage for skb in RX ISR Jian-Hong Pan
2019-07-08  7:23 ` Tony Chuang
2019-07-08  8:07   ` Jian-Hong Pan
2019-07-08  9:00     ` Tony Chuang
2019-07-08  9:18       ` David Laight [this message]
2019-07-08  8:36 ` David Laight
2019-07-08 18:01 ` Larry Finger
2019-07-09 10:20 ` [PATCH v2 1/2] rtw88: pci: " Jian-Hong Pan
2019-07-10  8:36   ` Tony Chuang
2019-07-10  8:54     ` Jian-Hong Pan
2019-07-09 10:21 ` [PATCH v2 2/2] rtw88: pci: Use DMA sync instead of remapping " Jian-Hong Pan
2019-07-09 16:15   ` Christoph Hellwig
2019-07-10  8:38     ` [PATCH v3 1/2] rtw88: pci: Rearrange the memory usage for skb " Jian-Hong Pan
2019-07-10  8:57       ` David Laight
2019-07-11  3:50         ` Jian-Hong Pan
2019-07-11  5:24           ` [PATCH v4 " Jian-Hong Pan
2019-07-11  5:24             ` [PATCH v4 2/2] rtw88: pci: Use DMA sync instead of remapping " Jian-Hong Pan
2019-07-11  5:30               ` Jian-Hong Pan
2019-07-11  5:28             ` [PATCH v4 1/2] rtw88: pci: Rearrange the memory usage for skb " Jian-Hong Pan
2019-07-24  6:13               ` Jian-Hong Pan
2019-07-24 11:49             ` Kalle Valo
2019-08-15 20:25       ` [PATCH v3 " Brian Norris
2019-07-10  8:38     ` [PATCH v3 2/2] rtw88: pci: Use DMA sync instead of remapping " Jian-Hong Pan

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=85e3b48ee6694aa491c7caa73c027e0f@AcuMS.aculab.com \
    --to=david.laight@aculab.com \
    --cc=davem@davemloft.net \
    --cc=drake@endlessm.com \
    --cc=jian-hong@endlessm.com \
    --cc=kvalo@codeaurora.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-wireless@vger.kernel.org \
    --cc=linux@endlessm.com \
    --cc=netdev@vger.kernel.org \
    --cc=stable@vger.kernel.org \
    --cc=yhchuang@realtek.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 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).