linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: David Miller <davem@davemloft.net>
To: herbert.tencent@gmail.com
Cc: linux-kernel@vger.kernel.org, netdev@vger.kernel.org
Subject: Re: [PATCH] netdev: add netdev_pagefrag_enabled sysctl
Date: Sat, 11 Nov 2017 19:20:00 +0900 (KST)	[thread overview]
Message-ID: <20171111.192000.1052079702439602290.davem@davemloft.net> (raw)
In-Reply-To: <05cb873f-3edf-f115-305c-81b5ace8d76e@gmail.com>

From: Hongbo Li <herbert.tencent@gmail.com>
Date: Thu, 9 Nov 2017 16:12:27 +0800

> From: Hongbo Li <herberthbli@tencent.com>
> 
> This patch solves a memory frag issue when allocating skb.
> I found this issue in a udp scenario, here is my test model:
> 1. About five hundreds udp threads listen on server,
>    and five hundreds client threads send udp pkts to them.
>    Some threads send pkts in a faster speed than others.
> 2. The user processes on server don't have enough ability
>    to receive these pkts.
> 
> Then I got following result:
> 1. Some udp sockets' recv-q reach the queue's limit, others
>    not because of the global rmem limit.
> 2. The "free" command shows "used" memory is more than 62GB.
>    But cat /proc/net/sockstat shows that udp uses only 12GB.
> 
> This will confused the user that why the system consumes so
> many memory.This is caused by the memory frags in netdev layer.
> __netdev_alloc_frag() allocs a page block which has 8 pages.
> 
> Then in this scenario, most skbs are freed when the recv-q
> is full, but if any skb in the same page block be queued to
> other recv-q which is not full, the whole page block can't
> be freed.
> 
> So from the view of kernel, these pages are used, but from
> the view of tcp/udp, only the skbs in recv-q are used.
> 
> To avoid exhausting memory in such scenario, I add a sysctl
> to make user can disable allocating skbs in page frag.
> 
> Signed-off-by: Hongbo Li <herberthbli@tencent.com>

When something like page fragments don't work properly, we fix
them rather then providing a way to disable them.

Thank you.

      reply	other threads:[~2017-11-11 10:20 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-11-09  8:12 [PATCH] netdev: add netdev_pagefrag_enabled sysctl Hongbo Li
2017-11-11 10:20 ` David Miller [this message]

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=20171111.192000.1052079702439602290.davem@davemloft.net \
    --to=davem@davemloft.net \
    --cc=herbert.tencent@gmail.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=netdev@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).