Received: by 2002:a05:6a10:22f:0:0:0:0 with SMTP id 15csp627993pxk; Wed, 23 Sep 2020 11:41:21 -0700 (PDT) X-Google-Smtp-Source: ABdhPJx9oJvWvVDAvXhS1DEjDiH/ncXSFY5GWz+tZWbgfwct7xF8B+qCh91Ee2gkWC7KvLEVxmq6 X-Received: by 2002:a05:6402:3050:: with SMTP id bu16mr678613edb.343.1600886481771; Wed, 23 Sep 2020 11:41:21 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1600886481; cv=none; d=google.com; s=arc-20160816; b=02IgY08xaQWj3hmQehnZ41ipOxSDPynTVbSTArvjLh/XoTAzqziijaCeDfofexKr1M M1zJSBYWLmgc+zaxoGCrvvfvbbm2MNx1Tj5ktOIQpHofLcHAn3OqCYK35oeURS+96l4d 6mwWx2u8dOChAedc23FXpiG3Rb29rzrHGY9PCM2NdA6mx9dbuFV0V8HutcHVcx4D7nn5 Z6qHOjTVX6L01zudXi68YccfPlX9ZS1PBLp20K1myOaiU7tcK+ewnE5gK2NgHt0JV3sV kD7IZ4REUPrOzDBqDF0DRgb7l2WXbl4DHJuzfSnj/xyRh0AWnVtel4uDdYt4reb8nUwx 6zFw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:cc:to:subject :message-id:date:from:mime-version:dkim-signature; bh=FAP0TU2uPf481PQbEvwy2npjBiSvL3xKk9qiULyhTDI=; b=V1BW0MDFwKGrZmk2qgXcDOp8HhV6KdfoZgNPNWD0gsOsG5pcopzSeSuTMxN4pEV5Rv r6Z0ldjJdL6o0aH6JXg1LJ0mBZjPtrkELY/ITo8uzBrXan/iU5t+mOsKXOGqMh0aKsfs EUtq4t3qutQX/ZoZhmvBaBjvE8pSthLxs2ILUzySr0o1StU5czMnfW9l3eDrZa5/OIJR ivLV21d2k0VP7RDJ1yPA89R4GXQZYZYOOAR2ZPOWDhfhKDk3Ckw65xY1wvr4f2fsDAdv 5ePM/w1LOVUsm2+1783DtVbefyCQ5FmdUXSBgbnpLilefJ54hSskC6dbElu6CDjbj+Sj Lekw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=pS7LoSUF; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id v25si432386eja.693.2020.09.23.11.40.58; Wed, 23 Sep 2020 11:41:21 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=pS7LoSUF; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726600AbgIWSju (ORCPT + 99 others); Wed, 23 Sep 2020 14:39:50 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:43908 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726332AbgIWSju (ORCPT ); Wed, 23 Sep 2020 14:39:50 -0400 Received: from mail-ed1-x535.google.com (mail-ed1-x535.google.com [IPv6:2a00:1450:4864:20::535]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id C04A4C0613CE for ; Wed, 23 Sep 2020 11:39:49 -0700 (PDT) Received: by mail-ed1-x535.google.com with SMTP id j2so787690eds.9 for ; Wed, 23 Sep 2020 11:39: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 :content-transfer-encoding; bh=FAP0TU2uPf481PQbEvwy2npjBiSvL3xKk9qiULyhTDI=; b=pS7LoSUFRBmfs4TqhR2/ItAtlPedY0WQT06Q3FkbUgVQKaRdFZgXcMtAk+teTn0ha2 UU8bIjgOI1fGpj1oThc5J+bFJR06Iv5DHQ3vcLWeB290ObzCWu8VrMGI9BWr5iER9qQ3 yQ6hlxfwrjyNZBC1R0tXV8XeF2k7PImSSqfXXYJdXaudpucKkdXVQdySH4TKNZKST80j lstaz6r5eoqvrVYPhDyVuZFwsqi3gnG6yQKHJX8DOVBOLnMqO5KPJ5mXn8/TIQeGiu6e Tx4FeIm2ZD3DUETNnH/hBuJZs+iJijiC6otSn+n+BGYV0qJRwCcEkz66DjijtDWnX79P 76Bg== 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 :content-transfer-encoding; bh=FAP0TU2uPf481PQbEvwy2npjBiSvL3xKk9qiULyhTDI=; b=oIhMozLHN+2zw8N3OAFRur+z/+8V195xtXgX5MY7xjjhPEmJvbD76Y+l0pci6ZE8PZ 8TXC/H1BgJlWGweqdVCsn5Jn5FJP9ZUiH//1QUSp2c8gpNwVA/oon6g8VFx2HAp/nq/j ztKOFmcq1fFx0FYsoauBfqk1FI25qJ+ygxDEHWFpI0k9f4WSVBuIAlteA+SULsTI1hgU 83ets58PSZUls4/uKB50Nqj4gPavX5VhNChZ0BUfGeRUvJFSfbOWff3gVTBaeeIn4CZL 3HKYsuf9kyURCnMteemasb8eeXnC3ba+DBds4Mm2x5Aq+gOWqoAOmOZb3Ewf0SAEVCKK CeEQ== X-Gm-Message-State: AOAM533xAsyDncwAY2FXCYUVpwnGmd7+GhLEFMqO8U2H79cepVfoH8pA 2yY4brJ8ZaaEfA+h1pYSJMlx+CqEcuX93YQpbYau+fu5b/n8ITCY X-Received: by 2002:a50:d4d8:: with SMTP id e24mr731780edj.1.1600886386948; Wed, 23 Sep 2020 11:39:46 -0700 (PDT) MIME-Version: 1.0 From: Ronny Meeus Date: Wed, 23 Sep 2020 20:39:35 +0200 Message-ID: Subject: Kernel work in user context To: linux-kernel@vger.kernel.org Cc: Ronny Meeus Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Hello I have a system, running on a 2 core device, doing packet processing. The kernel version is 4.9. 2 applications communicate with each other via IPC. One application is receiving packets from an ethernet interface and after doing some preprocessing it forwards the packets to the other application. Next to these 2 applications a lot of other applications are running, so the system is under high load. Depending on the IPC mechanism I use between the 2 apps, I see a completely different CPU load pattern. The total load consumed by the 2 applications when using stream based Unix Domain sockets (UDS) is 130% (200% =3D full load on the 2 cores). The load consumed when using posix message queues is only 90%. Apart from some IPC implementation details, the logic is identical in the 2 tests so I cannot explain the 40% difference on the total load. I was doing some monitoring with top and in the /proc//stat files of the 2 applications and I have the feeling that in the case of UDS, a lot more system processing is done in the application threads. I'm talking about the "stime" info the stat file. When I read "kernel-hacking/hacking.html" in the linux documentation I see: "Whenever a system call is about to return to userspace, or a hardware interrupt handler exits, any =E2=80=98software interrupts=E2=80=99 which ar= e marked pending (usually by hardware interrupts) are run (kernel/softirq.c)." Can it be that this is the case for the read/write system calls used by UDS while this is not the case for the mqueue system calls (mq_timedsend/mq_timedreceive)? BTW the system is running with "threadirqs" enabled so that the irq work is done in dedicated kernel threads. Thanks Best regards, Ronny