From owner-freebsd-net@freebsd.org Thu Apr 9 09:17:50 2020 Return-Path: Delivered-To: freebsd-net@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 3FC2A2B4242; Thu, 9 Apr 2020 09:17:50 +0000 (UTC) (envelope-from ozkan.kirik@gmail.com) Received: from mail-vs1-xe34.google.com (mail-vs1-xe34.google.com [IPv6:2607:f8b0:4864:20::e34]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (2048 bits) client-digest SHA256) (Client CN "smtp.gmail.com", Issuer "GTS CA 1O1" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 48ybCK1zhMz4MKn; Thu, 9 Apr 2020 09:17:49 +0000 (UTC) (envelope-from ozkan.kirik@gmail.com) Received: by mail-vs1-xe34.google.com with SMTP id s25so4546144vsp.11; Thu, 09 Apr 2020 02:17:49 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:from:date:message-id:subject:to:cc; bh=FgjZI4jL1xLNR5LM153d7T1DCZM6A4aTeSpQ3y6uNwo=; b=L6NExeWbyYj+Xv91sPaExtoi4RWR+en1Xj+te3KDo+Yab++q4Z6T1OF8cjKjU8o2Zb 9S5t9yaBr3I45Z6zqcm4o3t3Vw+dalV2KQx2vqw9Kx8C/R9YJS5s9sj+jGj9C0oX4oPk vWJpsi+j/Fu4uXuli+UH9nW5Zk2azpGRSISPT5kvuh0s7j7MQ8gggqEcBhWaIvNUPiw9 lEmVmoy/KbDajz0bSeUdNV1QuW0BrWGXJhYx0wsknVlkpSvpDC80meuhhJV/RvLAY+Th UACNX02lnk+ODID1Jizn8rIYZEqTycHrvTN3nFSw0qL2tVo3523ygO/9zWP8Hm/Kke7/ B6XQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:from:date:message-id:subject:to:cc; bh=FgjZI4jL1xLNR5LM153d7T1DCZM6A4aTeSpQ3y6uNwo=; b=gmUCEiSjcwGzEqUnx36EEYAff9TN/ZFGyZ/xB0+zK1dM7Oj870oSTOinZ6WDp0mSA2 WxbEtMzKOUCoFtIJ14vZJHFRyYHDq1X8fZIE9MU9+rADPrX3en+AXI17Ug2k9ppsVwD3 lc3vIxKrtCg/uQCA5FGUorBYsN08Uca857Ys+NEVbl3eb4nLKo0CZmb24//rCfgi6QpB 7cWrxe0ImzjpPG7YocZ5TcxrvEXSs8tzGNQdAPvrLPpLG3ncyfB1R3qiHL0Od1FIolzt ywhwkNBTmjX51fJYrl6EGZyNax6UkpYQbrLXFM/Wscttlf+oscD1r5a7gKJxN5LeMxfR wiYA== X-Gm-Message-State: AGi0PuaugVO0YhAm0d7+Ug6wQZ43aX14MPj54wNX0VjkRvSKYsp/Tl5q nqkPRylLrjeY650u6FjgqEDE3gHnlroa3RAsEG2BNE1f X-Google-Smtp-Source: APiQypJWKgINDnWNqi4Qk7Nvs3nbzrdzaTLLtB989bxtzym2H3uuyQRwdjUYJfy+PvkWq/WYts6mqaRbm8IF9bcozOY= X-Received: by 2002:a67:80d1:: with SMTP id b200mr7285256vsd.76.1586423867796; Thu, 09 Apr 2020 02:17:47 -0700 (PDT) MIME-Version: 1.0 From: =?UTF-8?B?w5Z6a2FuIEtJUklL?= Date: Thu, 9 Apr 2020 12:17:35 +0300 Message-ID: Subject: dummynet performance To: freebsd-net@freebsd.org, freebsd-ipfw Cc: Luigi Rizzo , "Andrey V. Elsukov" X-Rspamd-Queue-Id: 48ybCK1zhMz4MKn X-Spamd-Bar: - Authentication-Results: mx1.freebsd.org; dkim=pass header.d=gmail.com header.s=20161025 header.b=L6NExeWb; dmarc=pass (policy=none) header.from=gmail.com; spf=pass (mx1.freebsd.org: domain of ozkankirik@gmail.com designates 2607:f8b0:4864:20::e34 as permitted sender) smtp.mailfrom=ozkankirik@gmail.com X-Spamd-Result: default: False [-2.00 / 15.00]; ARC_NA(0.00)[]; NEURAL_HAM_MEDIUM(-1.00)[-1.000,0]; R_DKIM_ALLOW(-0.20)[gmail.com:s=20161025]; FROM_HAS_DN(0.00)[]; RCPT_COUNT_THREE(0.00)[4]; R_SPF_ALLOW(-0.20)[+ip6:2607:f8b0:4000::/36]; FREEMAIL_FROM(0.00)[gmail.com]; MIME_GOOD(-0.10)[multipart/alternative,text/plain]; IP_SCORE(0.00)[ip: (-9.63), ipnet: 2607:f8b0::/32(-0.33), asn: 15169(-0.43), country: US(-0.05)]; NEURAL_HAM_LONG(-1.00)[-1.000,0]; TO_DN_SOME(0.00)[]; URI_COUNT_ODD(1.00)[3]; IP_SCORE_FREEMAIL(0.00)[]; TO_MATCH_ENVRCPT_SOME(0.00)[]; DKIM_TRACE(0.00)[gmail.com:+]; DMARC_POLICY_ALLOW(-0.50)[gmail.com,none]; RCVD_IN_DNSWL_NONE(0.00)[4.3.e.0.0.0.0.0.0.0.0.0.0.0.0.0.0.2.0.0.4.6.8.4.0.b.8.f.7.0.6.2.list.dnswl.org : 127.0.5.0]; RCVD_COUNT_TWO(0.00)[2]; FROM_EQ_ENVFROM(0.00)[]; MIME_TRACE(0.00)[0:+,1:+,2:~]; FREEMAIL_ENVFROM(0.00)[gmail.com]; ASN(0.00)[asn:15169, ipnet:2607:f8b0::/32, country:US]; TAGGED_FROM(0.00)[]; RCVD_TLS_ALL(0.00)[]; DWL_DNSWL_NONE(0.00)[gmail.com.dwl.dnswl.org : 127.0.5.0] Content-Type: text/plain; charset="UTF-8" X-Content-Filtered-By: Mailman/MimeDel 2.1.29 X-BeenThere: freebsd-net@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Networking and TCP/IP with FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 09 Apr 2020 09:17:50 -0000 Hello, I wonder if it is possible to update dummynet code multi-threading capable practically? My idea is below: - A new sysctl tunable will be defined as "net.inet.ip.dummynet.thread_count" (default 1) - To distribute tasks along threads, each sched instance can be assigned to different thread. - By default, all schedulers assigned to thread 0 if no thread_id is set. With a new option named "thr_id" affinity can be set. as below: ipfw sched 1 config type QFQ (by defaut thr_id = 0) ipfw sched 2 config type QFQ thr_id 1 ipfw sched 3 config type QFQ thr_id 2 ipfw sched 4 config type FIFO thr_id 3 ipfw sched 5 config type FIFO thr_id 3 ( sched 4 & 5 assigned to same thread 3 ) I think this approach is more easy then completely rewrite or other solutions. What is the right way to do this? Where to start? I read the explanations in /usr/src/sys/netpfil/ipfw/dummynet.txt On this line below, multiple threads (count can be get from sysctl "net.inet.ip.dummynet. thread_count" tunable) https://github.com/freebsd/freebsd/blob/master/sys/netpfil/ipfw/ip_dummynet.c#L2556 Thanks