Received: by 2002:a05:6a11:4021:0:0:0:0 with SMTP id ky33csp231298pxb; Mon, 13 Sep 2021 17:50:21 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwJ8A1Sc5oDKnwFBmFjDEasu3hSVuY7ccz50T3lWBr7jsNWumI10rvPwwRJJI0bHptKJM+x X-Received: by 2002:a05:6402:26c4:: with SMTP id x4mr16262109edd.54.1631580621657; Mon, 13 Sep 2021 17:50:21 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1631580621; cv=none; d=google.com; s=arc-20160816; b=k5xPBDc20Q2dg0fAp1pt2c9608/lCNym9TxqikFr14Qg8fOw9/y2VeunlHfnkG6gQ3 6WyB69BQz8/Xz+TVKM0BvKT8pvEYILahCQUklnvS7ZcpRhOHPje/AUTjOxlHD3YKcE5m H6FRGzzhejIXLWfrwsCwyX+8C3hf8hFtUQ4QHmc7HdP2xUezA94X9YQEfxDiAnnhhPmk eTRHwasXNi0iaN/YTc2NYI8ybSqyVVnZAQxYDX4mPNAb1nnLhSpKcF25PuqG0BK83j8m IEiMXvEx8BrYk6nbRGQv28dnHyJYVcqmAOYw34j35wxFNKg7cYHhXj/90+jSpHimSyBi sbHQ== 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:in-reply-to:references:mime-version :dkim-signature; bh=iPLu6FRs6PsytvQa213g6Z9ikwL4Ay1Rx6H9mdVXAQY=; b=WXB0CSto1UFU7L1ou2BqKMJb8zdKULfypCo+15YBfvFxTIezCWesUs2rCFCczfJAC+ p3WF8caU9DjJpUr1idmp5QY+Z7EDw0om2qqboR0iqEoPSErkkm/k3qhm1S5sv3hMkJ0i zaTYqZ27yPvFkfdVP7ikPcuoyJyDbNOmGXbP29riL6cz77K3x1J66F9Wj+APzP5gYlCw HsSmQSxbUmK9Rh6F1YcDUiu1SUJ+oVhEAh18eK6T6tf4NxYJbAXnw1YHRyO7YyrrOizD pkrzXsiy9C8JtUPiWheZReImbBVDCWIe0gEcVGElLfkD6XTZRbXLiaiM+oh+LYSP0nY8 /u8g== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@google.com header.s=20210112 header.b=OdpG3Pcs; 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=REJECT sp=REJECT dis=NONE) header.from=google.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id cs18si8008683ejc.483.2021.09.13.17.49.58; Mon, 13 Sep 2021 17:50: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=@google.com header.s=20210112 header.b=OdpG3Pcs; 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=REJECT sp=REJECT dis=NONE) header.from=google.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1344539AbhIMSBh (ORCPT + 99 others); Mon, 13 Sep 2021 14:01:37 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:38508 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S239852AbhIMSBg (ORCPT ); Mon, 13 Sep 2021 14:01:36 -0400 Received: from mail-lf1-x129.google.com (mail-lf1-x129.google.com [IPv6:2a00:1450:4864:20::129]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id B6426C061574 for ; Mon, 13 Sep 2021 11:00:19 -0700 (PDT) Received: by mail-lf1-x129.google.com with SMTP id h16so22834720lfk.10 for ; Mon, 13 Sep 2021 11:00:19 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20210112; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc:content-transfer-encoding; bh=iPLu6FRs6PsytvQa213g6Z9ikwL4Ay1Rx6H9mdVXAQY=; b=OdpG3PcsFCgf1/KlZhYOeLEsAkkVqhp725gZbfyKUJvZImP2NoJQ4oPWzRjmms5RQY AH7+AjdIFkt9sJkrDf0/3R09oGRkzogfJogqEmzUqsADzty/9i9KztZnqzXDWA1zfOdD K+303eXak0Xe0qNmGBE5lelHCy3CyndWlbSMC3Mma3S7W3ntT0vGwOskKsb/I0hpaV1w QF7xT+iopj/Fez7AtArDtnl5AMnwSGv3GYSzj8CpbxmHtWhAuPaafPVEnCp8LGxpQxxx 2nQ3i/ngFXiX5YLRTyoQznYMwWyqEdwX5jeYcYw2ymD/5W7DkrhUpH0bXEt3Y1VyrC40 cVHw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc:content-transfer-encoding; bh=iPLu6FRs6PsytvQa213g6Z9ikwL4Ay1Rx6H9mdVXAQY=; b=M7JAkovL5w3izboaSESeIMpk+L5/ndH0jbk63lAqxrkbjxTSWQjRiT9K6kVS6dpG0X hQJXOryR4LNRc8On1hlffS+P6+QOUPpgeA3/71EkioD25OnG2cqbj6+SHpcvBtvQFhkL f8rCRbEwTzv6GSeVt0gmJiXIUz8cTdGeYHhB8dYhTe2aejMZLApMGeNYTV3BeVbd1JYR HFncmQrQPCo5GZ0zLin3dxpF41ZofWVOgqVJqKk7nqCJCwc7+MFwj268fg7lr9P34tiz Ve8vCne8WKwXUNqu9eYmKtQwyY+OKELfz1vESpKGab5nm0FjH4Yyuv/uV11VkHA0kENA sDEw== X-Gm-Message-State: AOAM530AsRoIqXLANwq0vk5aYsEOAQLU1rcYaW8Ukt1UypaDzzfmHyQP HNCbHg/UinBo4G/91Kzg38OaVribhECrfgJU/47SCg== X-Received: by 2002:ac2:4e98:: with SMTP id o24mr9884811lfr.295.1631556017864; Mon, 13 Sep 2021 11:00:17 -0700 (PDT) MIME-Version: 1.0 References: <1631147036-13597-1-git-send-email-prakash.sangappa@oracle.com> <3591AC6D-45D2-476A-80B1-46BFA1742602@oracle.com> <6A88B271-EC5E-46B7-8D60-A7543635FDC5@oracle.com> In-Reply-To: <6A88B271-EC5E-46B7-8D60-A7543635FDC5@oracle.com> From: Peter Oskolkov Date: Mon, 13 Sep 2021 11:00:06 -0700 Message-ID: Subject: Re: [RESEND RFC PATCH 0/3] Provide fast access to thread specific data To: Prakash Sangappa Cc: Jann Horn , Linux Kernel Mailing List , linux-api , Ingo Molnar , Paul Turner , Peter Oskolkov , Peter Zijlstra Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Mon, Sep 13, 2021 at 10:36 AM Prakash Sangappa wrote: [...] > > This sounds, again, as if the kernel should be aware of the kind of > > items being allocated; having a more generic mechanism of allocating > > pinned memory for the userspace to use at its discretion would be more > > generally useful, I think. But how then the kernel/system should be > > protected from a buggy or malicious process trying to grab too much? > > > > One option would be to have a generic in-kernel mechanism for this, > > but expose it to the userspace via domain-specific syscalls that do > > the accounting you hint at. This sounds a bit like an over-engineered > > solution, though=E2=80=A6 > > > What will this pinned memory be used for in your use case, > can you explain? For userspace scheduling, to share thread/task state information between the kernel and the userspace. This memory will be allocated per task/thread; both the kernel and the userspace will write to the shared memory, and these reads/writes will happen not only in the memory regions belonging to the "current" task/thread, but also to remote tasks/threads. Somewhat detailed doc/rst is here: https://lore.kernel.org/lkml/20210908184905.163787-5-posk@google.com/