Received: by 2002:a05:6a10:eb17:0:0:0:0 with SMTP id hx23csp734958pxb; Thu, 9 Sep 2021 10:44:09 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwk8W4UQZijyHbM3Go/AAthGdC6L1cvEuGzAKvpZxVhkWloPXbAxd43uIROtQh2EY1mAKcD X-Received: by 2002:a05:6e02:2165:: with SMTP id s5mr3195016ilv.274.1631209448840; Thu, 09 Sep 2021 10:44:08 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1631209448; cv=none; d=google.com; s=arc-20160816; b=Wc0pyD/Dh363rVLtvIgRfVY3IDIDLBwnkVY0JL2VpK856P4IiTgDMHIe7JiONfP4fx tc8R3VbTSZ2EbvMRedtWLkX2CEAwGz/cPAeMq9Ou4Jy8ULl8SPFYn2lHokRdq5akuOc4 ZMBJ2CEYiP1EUt9tTsj4TjnZNlpJ6umaf1sX1nnbj2Htn3Qkif2SgPIEDmFrKIFeSUiO Nr7tPSv9y4dylAqCXS7xfm5HnHxG3cZ1TKpm42w34uB/OYgXZ+wWg/jsNRPD87JCAZCK 1/VzpV6LMmF4Qs7ruU8rZEvL6L5noxfQSvq9OvRfV7cWQpzwUUK1fg1GzO3EWoR5UGo9 GXOQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:cc:to:subject:message-id:date:from:in-reply-to :references:mime-version:dkim-signature; bh=IDTb4rA4Iui5aRziLg9MwZ0JPlkvhlzJK5j6CG2YU+0=; b=nJPtgasyZcdzsFkkI0D/VNjs8hbGN3U4QJwMlxjkUmHQSu/9uxGqEp1euoUZG/XV2Y BhZsuATGVpxCWfRfZzrasg2dSm2XpS8WQSM8LTYvsgyOhxJiE5Wz4msQAqdtvary0O23 VbHq8/YSOAq4NqC1wCm1jgdlrhQmLPOgSRlxI5Na0PGHRHrCk9bmRJL+9SDwVs+vNYYZ ouRmt0/r4Mqy3WAo00+zGcX4b4WaI83YP+Fj/4vY9WRix94ikI5vzhYyTfnCzRPGBCwy 65nsrrJl3zVVw/5usluK3s4KwAIoOCdxGnEPGvRS9N0oeKXPVRhBNVa+ZvldPyecnEud nWdQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=Pxs7yYPj; 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=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id 11si2576254ilq.55.2021.09.09.10.43.56; Thu, 09 Sep 2021 10:44:08 -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=@kernel.org header.s=k20201202 header.b=Pxs7yYPj; 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=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S237230AbhIIRoO (ORCPT + 99 others); Thu, 9 Sep 2021 13:44:14 -0400 Received: from mail.kernel.org ([198.145.29.99]:50984 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S237224AbhIIRoI (ORCPT ); Thu, 9 Sep 2021 13:44:08 -0400 Received: by mail.kernel.org (Postfix) with ESMTPSA id 6CC4761101 for ; Thu, 9 Sep 2021 17:42:58 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1631209378; bh=IDTb4rA4Iui5aRziLg9MwZ0JPlkvhlzJK5j6CG2YU+0=; h=References:In-Reply-To:From:Date:Subject:To:Cc:From; b=Pxs7yYPjI2FiogSgf75+K6JNUwG88sxc4d2EJyEAvBGzZnDI+PHGAw8avRptP4WEQ jFfZ1lcR2jvT4Tvo/idJXSCf1HfYKMT3ktsQQ0MysMm9b82cYmontz4So5K9Erw4Vv ypziB/SfDt1DhcM4Iq2mTMXsOh55kPipZp8g7tkKUePG8PfH4jrq7LCl3ACRGoNkT8 S0qmWsKZkD4mT3Jjmsc2N06bySrJo96fJ0VijW8OZmlIf4D29ZBAd9dcFaRzF8hImP M4bKgjKvQ0DLwvUYDPtz9N1XjxWswq76yR69fvZo5oYb3PRblKAqCin472/8z+nFDl yVXI312YGUzYQ== Received: by mail-ej1-f42.google.com with SMTP id i21so5237714ejd.2 for ; Thu, 09 Sep 2021 10:42:58 -0700 (PDT) X-Gm-Message-State: AOAM531hpXybilrQQh8kb+0RxYQFXwDezhVnA+RkYeZel4Ch2oindkqC chs4bvWk6DsyGFl6LV/5PanfANO6RcxawuGgpWzmFQ== X-Received: by 2002:a17:906:2cd5:: with SMTP id r21mr4773787ejr.435.1631209377027; Thu, 09 Sep 2021 10:42:57 -0700 (PDT) MIME-Version: 1.0 References: <1631146225-13387-1-git-send-email-prakash.sangappa@oracle.com> In-Reply-To: <1631146225-13387-1-git-send-email-prakash.sangappa@oracle.com> From: Andy Lutomirski Date: Thu, 9 Sep 2021 10:42:43 -0700 X-Gmail-Original-Message-ID: Message-ID: Subject: Re: [RESEND RFC PATCH 0/3] Provide fast access to thread specific data To: Prakash Sangappa Cc: Linux API , Ingo Molnar , LKML Content-Type: text/plain; charset="UTF-8" Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Wed, Sep 8, 2021 at 5:02 PM Prakash Sangappa wrote: > > Resending RFC. This patchset is not final. I am looking for feedback on > this proposal to share thread specific data for us in latency sensitive > codepath. > > (patchset based on v5.14-rc7) > > Cover letter previously sent: > ---------------------------- > > Some applications, like a Databases require reading thread specific stats > frequently from the kernel in latency sensitive codepath. The overhead of > reading stats from kernel using system call affects performance. > One use case is reading thread's scheduler stats from /proc schedstat file > (/proc/pid/schedstat) to collect time spent by a thread executing on the > cpu(sum_exec_runtime), time blocked waiting on runq(run_delay). These > scheduler stats, read several times per transaction in latency-sensitive > codepath, are used to measure time taken by DB operations. > > This patch proposes to introduce a mechanism for kernel to share thread > stats thru a per thread shared structure shared between userspace and > kernel. The per thread shared structure is allocated on a page shared > mapped between user space and kernel, which will provide a way for fast > communication between user and kernel. Kernel publishes stats in this > shared structure. Application thread can read from it in user space > without requiring system calls. Can these use cases be addressed by creating a perf event (perf_event_open) and mmapping it?