Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 8F3E1C636D7 for ; Thu, 23 Feb 2023 08:40:18 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233644AbjBWIkQ (ORCPT ); Thu, 23 Feb 2023 03:40:16 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:36978 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233598AbjBWIkN (ORCPT ); Thu, 23 Feb 2023 03:40:13 -0500 Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.129.124]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 53F1D1422A for ; Thu, 23 Feb 2023 00:39:23 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1677141562; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=5sPuPMmKl8Fh55oJyqKfdWjSTl4UX6ztUqAWilF1Ap8=; b=WoxGTWYjPziAI076K06HglUX3Ov4DLC5GDT9UeMgHiRsyU7nGtvfO/f0o7tEmWCc6jyGFw Bsi18+a8Cq5VCSbYGSqImBAlwL2K43QDSP+AQOdnmklI/c3ipLkfUJWZLlWX6bgMDIMwzo ZNxVFVXecmISy0TFQJb5D+svpMN3ZGQ= Received: from mail-wr1-f70.google.com (mail-wr1-f70.google.com [209.85.221.70]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_128_GCM_SHA256) id us-mta-313-3-F7ZLJZNN6mzO3kEDxWIQ-1; Thu, 23 Feb 2023 03:39:21 -0500 X-MC-Unique: 3-F7ZLJZNN6mzO3kEDxWIQ-1 Received: by mail-wr1-f70.google.com with SMTP id i6-20020adffc06000000b002c5669766a8so2260510wrr.4 for ; Thu, 23 Feb 2023 00:39:20 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; t=1677141560; h=mime-version:user-agent:content-transfer-encoding:references :in-reply-to:date:cc:to:from:subject:message-id:x-gm-message-state :from:to:cc:subject:date:message-id:reply-to; bh=5sPuPMmKl8Fh55oJyqKfdWjSTl4UX6ztUqAWilF1Ap8=; b=YJW6wEqu7/vQbok1p8SqiylG97JQKFcu4FGR7GCaRP+3BogPHVm15frgeODLzPI+Fm 4J7hF1mk2abDjxcrvfojE++u+oTgFr7CVShvmxOB+dR/l9fGyDzZGAyUH/bfu7lHjrOH GHH/6M5Yh4nFvmFmQqj2IYuMpe0cjIFs4vKcI0bHLyOT42VT1ps/+IG+4Vza16ELYGm5 5Q6w9UfbPMlKE2YQHqxC772FcFnTPq2XEocuhpSEDOB2W7up55jLJ8xlqQC/eUmtt1Vx 27lrI8rjbvH6vrawAtUXZ1zBlPChDlWWu3BPev287kB5spERzzYaIkgdmUtfgaOINk8H aI2w== X-Gm-Message-State: AO0yUKWyDWn3LA/GN6v90nn7L4zeuJpLdhB8m74gPiT7fHFhZt5RK7lL t4dLJ7+AhMk6yZfrcs7M697E3YiLcVpSEAV2V9E9gW5/V2itG9Rl7845pdwECQaGxD1WQOI6d49 UI6se43tAh9ABNAohdP4v0con X-Received: by 2002:a1c:741a:0:b0:3e2:415:f09f with SMTP id p26-20020a1c741a000000b003e20415f09fmr10130676wmc.3.1677141559962; Thu, 23 Feb 2023 00:39:19 -0800 (PST) X-Google-Smtp-Source: AK7set98+o6jJ1qOgbToOoRq/imOK3FoKhZ+VL6UYssekxL/stE0Ck+L7wA5jcx60YYmNlFc6d2hsA== X-Received: by 2002:a1c:741a:0:b0:3e2:415:f09f with SMTP id p26-20020a1c741a000000b003e20415f09fmr10130657wmc.3.1677141559590; Thu, 23 Feb 2023 00:39:19 -0800 (PST) Received: from gerbillo.redhat.com (146-241-121-8.dyn.eolo.it. [146.241.121.8]) by smtp.gmail.com with ESMTPSA id u7-20020a05600c19c700b003e21f20b646sm12230241wmq.21.2023.02.23.00.39.17 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 23 Feb 2023 00:39:18 -0800 (PST) Message-ID: <795aed3f0e433a89fb72a8af3fc736f58dea1bf1.camel@redhat.com> Subject: Re: [PATCH net] udp: fix memory schedule error From: Paolo Abeni To: Jason Xing Cc: willemdebruijn.kernel@gmail.com, davem@davemloft.net, dsahern@kernel.org, edumazet@google.com, kuba@kernel.org, netdev@vger.kernel.org, linux-kernel@vger.kernel.org, bpf@vger.kernel.org, Jason Xing Date: Thu, 23 Feb 2023 09:39:17 +0100 In-Reply-To: References: <20230221110344.82818-1-kerneljasonxing@gmail.com> <48429c16fdaee59867df5ef487e73d4b1bf099af.camel@redhat.com> Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable User-Agent: Evolution 3.46.4 (3.46.4-1.fc37) MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Wed, 2023-02-22 at 11:47 +0800, Jason Xing wrote: > On Tue, Feb 21, 2023 at 11:46 PM Jason Xing w= rote: > >=20 > > On Tue, Feb 21, 2023 at 10:46 PM Paolo Abeni wrote: > > >=20 > > > On Tue, 2023-02-21 at 21:39 +0800, Jason Xing wrote: > > > > On Tue, Feb 21, 2023 at 8:27 PM Paolo Abeni wro= te: > > > > >=20 > > > > > On Tue, 2023-02-21 at 19:03 +0800, Jason Xing wrote: > > > > > > From: Jason Xing > > > > > >=20 > > > > > > Quoting from the commit 7c80b038d23e ("net: fix sk_wmem_schedul= e() > > > > > > and sk_rmem_schedule() errors"): > > > > > >=20 > > > > > > "If sk->sk_forward_alloc is 150000, and we need to schedule 150= 001 bytes, > > > > > > we want to allocate 1 byte more (rounded up to one page), > > > > > > instead of 150001" > > > > >=20 > > > > > I'm wondering if this would cause measurable (even small) perform= ance > > > > > regression? Specifically under high packet rate, with BH and user= -space > > > > > processing happening on different CPUs. > > > > >=20 > > > > > Could you please provide the relevant performance figures? > > > >=20 > > > > Sure, I've done some basic tests on my machine as below. > > > >=20 > > > > Environment: 16 cpus, 60G memory > > > > Server: run "iperf3 -s -p [port]" command and start 500 processes. > > > > Client: run "iperf3 -u -c 127.0.0.1 -p [port]" command and start 50= 0 processes. > > >=20 > > > Just for the records, with the above command each process will send > > > pkts at 1mbs - not very relevant performance wise. > > >=20 > > > Instead you could do: > > >=20 > >=20 > > > taskset 0x2 iperf -s & > > > iperf -u -c 127.0.0.1 -b 0 -l 64 > > >=20 > >=20 > > Thanks for your guidance. > >=20 > > Here're some numbers according to what you suggested, which I tested > > several times. > > ----------|IFACE rxpck/s txpck/s rxkB/s txkB/s > > Before: lo 411073.41 411073.41 36932.38 36932.38 > > After: lo 410308.73 410308.73 36863.81 36863.81 > >=20 > > Above is one of many results which does not mean that the original > > code absolutely outperforms. > > The output is not that constant and stable, I think. >=20 > Today, I ran the same test on other servers, it looks the same as > above. Those results fluctuate within ~2%. >=20 > Oh, one more thing I forgot to say is the output of iperf itself which > doesn't show any difference. > Before: Bitrate is 211 - 212 Mbits/sec > After: Bitrate is 211 - 212 Mbits/sec > So this result is relatively constant especially if we keep running > the test over 2 minutes. Thanks for the testing. My personal take on this one is that is more a refactor than a bug fix - as the amount forward allocated memory should always be negligible for UDP.=20 Still it could make sense keep the accounting schema consistent across different protocols. I suggest to repost for net-next, when it will re- open, additionally introducing __sk_mem_schedule() usage to avoid code duplication. Thanks, Paolo