All of lore.kernel.org
 help / color / mirror / Atom feed
From: Prakash Sangappa <prakash.sangappa@oracle.com>
To: Andy Lutomirski <luto@kernel.org>
Cc: Linux API <linux-api@vger.kernel.org>,
	Ingo Molnar <mingo@redhat.com>,
	LKML <linux-kernel@vger.kernel.org>
Subject: Re: [RESEND RFC PATCH 0/3] Provide fast access to thread specific data
Date: Tue, 14 Sep 2021 17:24:49 +0000	[thread overview]
Message-ID: <4A2A9989-F407-4D5D-A9ED-C82EF3E8103E@oracle.com> (raw)
In-Reply-To: <CALCETrVHf90pWD6YnE3DCOo2bw1StKGPvZMgFz9a08eWPK2pFg@mail.gmail.com>



> On Sep 9, 2021, at 10:42 AM, Andy Lutomirski <luto@kernel.org> wrote:
> 
> On Wed, Sep 8, 2021 at 5:02 PM Prakash Sangappa
> <prakash.sangappa@oracle.com> 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?


As I understand these will be sampling based used for profiling? So will not 
be suitable for the use case we are looking at. 

Also, it would require every thread to open and create perf event mappings. 
Not sure how well this would scale given the requirement Is for use by a large 
number of threads. 

The proposal here is to provision a per thread shared memory space(between 
userspace and kernel) with a small memory footprint as it needs to be allocated
from pinned memory, to share thread specific info, like per thread sched stats
here. This should have low overhead and scale better. 




  reply	other threads:[~2021-09-14 17:25 UTC|newest]

Thread overview: 20+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-09-09  0:10 [RESEND RFC PATCH 0/3] Provide fast access to thread specific data Prakash Sangappa
2021-09-09  0:10 ` [RESEND RFC PATCH 1/3] Introduce per thread user-kernel shared structure Prakash Sangappa
2021-09-09  6:39   ` Greg KH
2021-09-09 18:45     ` Prakash Sangappa
2021-09-09  0:10 ` [RESEND RFC PATCH 2/3] Publish tasks's scheduler stats thru the " Prakash Sangappa
2021-09-09  0:10 ` [RESEND RFC PATCH 3/3] Introduce task's 'off cpu' time Prakash Sangappa
2021-09-09 17:42 ` [RESEND RFC PATCH 0/3] Provide fast access to thread specific data Andy Lutomirski
2021-09-14 17:24   ` Prakash Sangappa [this message]
2021-09-09  0:23 Prakash Sangappa
     [not found] ` <CAFTs51VDUPWu=r9d=ThABc-Z6wCwTOC+jKDCq=Jk8Pfid61xyQ@mail.gmail.com>
2021-09-10 15:18   ` Fwd: " Peter Oskolkov
2021-09-10 16:13     ` Prakash Sangappa
2021-09-10 16:28       ` Peter Oskolkov
2021-09-10 19:12         ` Jann Horn
2021-09-10 19:36           ` Peter Oskolkov
2021-09-13 17:36             ` Prakash Sangappa
2021-09-13 18:00               ` Peter Oskolkov
2021-09-14 16:10                 ` Prakash Sangappa
2021-09-10 16:37     ` Fwd: " Florian Weimer
2021-09-10 17:33       ` Mathieu Desnoyers
2021-09-10 17:48         ` Peter Oskolkov
2021-09-10 17:55           ` Mathieu Desnoyers
2021-09-10 18:00             ` Peter Oskolkov

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=4A2A9989-F407-4D5D-A9ED-C82EF3E8103E@oracle.com \
    --to=prakash.sangappa@oracle.com \
    --cc=linux-api@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=luto@kernel.org \
    --cc=mingo@redhat.com \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.