Received: by 2002:a05:6a10:eb17:0:0:0:0 with SMTP id hx23csp1721914pxb; Fri, 10 Sep 2021 12:14:24 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwZB8r+tVImUERUL/B4Zblhne1g1g+bwF9aZF8Zgnt+6v5w2Duv8Wo6wiqudP3Uadl/7kLW X-Received: by 2002:a05:6638:1347:: with SMTP id u7mr2286877jad.34.1631301253766; Fri, 10 Sep 2021 12:14:13 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1631301253; cv=none; d=google.com; s=arc-20160816; b=BvKoLQomjPgHBr+eSG/PI0NjY+nSDG2uiuXNOBsNqmlCcK2WXXEpjo8DqORpGr0MVC Y1fwyJ1gnWHsenbJThjFWi3dkXqq3KbzMRnc+wRIX3TYEjP0Rr8J0MPS6NIhqSf4xTOz ZOPx/9WyV/H/IJmYcqx4B84jC+ZbuIbBFLpWTUeT/2ARw2BQXZAYoDD0rX/clmmq9ewt 5WdUme9n47F/9HuBZppYVlkvE7LZtlruRcNKoDZYb3+Df1wcnjeEF1lwh1ySVI0yJ2mj q8E2pUE4VgA6lHi3eeDRDdMW/GuMr9+7HYEUiwYKekJnOIfvg7f44PJUaaYzbYlU99fa EMug== 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=srYMDe++QnliOuROCsgFjptM040iRN2INrvA4QIwYuM=; b=hbq2wpp2oSbcetUcaIGZsfLPczfSclgsZDCC+tQNlVsrVGkAzVTg9SjDJ9PoFpDo4c OJO40u6XU+r2OMP0dIw6ybzj+d2XiyYSZsd3AO7rbRu7oy2IB6JLUrQqs8g8+1J5LYIa Oog4q1YupzlSHM6/+G1Rl2rOEL3cD1hxihOGpoK5QGZE9oKCZQZmb9U+wf/QEbhzh+0c 3lrvB4TeN6SLPZnHENYrKqJXrYcs2wGyFj26zG82P5FLAl/ia47DgMbioi5mc7v3TgOR xb9y0V20BIm8+azHffq1f/StVRZQjBVwzWS3WaPAXHEk/0RfqaDXiteBTe63XihasfJA 34wA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@google.com header.s=20210112 header.b=IpbKSMqW; 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 t22si6206120iom.43.2021.09.10.12.14.01; Fri, 10 Sep 2021 12:14:13 -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=IpbKSMqW; 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 S230489AbhIJTNr (ORCPT + 99 others); Fri, 10 Sep 2021 15:13:47 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:36952 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232347AbhIJTNp (ORCPT ); Fri, 10 Sep 2021 15:13:45 -0400 Received: from mail-lf1-x130.google.com (mail-lf1-x130.google.com [IPv6:2a00:1450:4864:20::130]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 6EAFAC061574 for ; Fri, 10 Sep 2021 12:12:33 -0700 (PDT) Received: by mail-lf1-x130.google.com with SMTP id l11so6102907lfe.1 for ; Fri, 10 Sep 2021 12:12:33 -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=srYMDe++QnliOuROCsgFjptM040iRN2INrvA4QIwYuM=; b=IpbKSMqWqJJtigxNgiA4UVTS8XpTsHs4gor/CaqvuHvr9Cg4VHviz9gtV3CUEYxF7K QxrZ/sa8LU9zyJSvHDUdk4ZD7icQB899a9GSkjrRmwVoV/3u7NXhNH0+lszZyqo2vdfO Fzco6tGp6+FJQgxdIVE/c7xanSzRNd0Qvq2HQHccRiJbF7PgqKYBw+JUMsPFEBmk+yXB juc4TyfMmWiTTA4P65fiiVEZ1YTDHQzHyzLOYZS5dLkPV+PdQEX7auBBNaiEqf7azlA0 ew+DeuPLe8l+6UtPJ1gC3ahtI4iQdAngZWEW5fJ3s4cVpls4zy6pRn4/YnFYuKjwzwF6 VIqQ== 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=srYMDe++QnliOuROCsgFjptM040iRN2INrvA4QIwYuM=; b=cGkfbZmd1KJVHyg8LIe7qpRZfL07/8559HU7cjLOieSDMRxotuN9nJbZBIzTWSl6sG xRinzm4SqdGKTR+kKJmXVSlHWtWmGZEpfc36ci0yaeZPDL5Gh2LMyr8uTpdOpb+3w4Rk KBuqR2Z6L9WeWdS/gsvEzx4+soS9fFsSWC8BdweQsrJM+4snijxPZ1eLt7fI8NfOftwC aHUSRUVyD3IEj+Q5eJRmByI0ufXb+AIjhXFxHGWasIcEHFJSnPPqZWFsnyDbBhh0E62n cgXko7035QDG6AfurCyuF/TgrsOm8J8tblIlntbYKghgMWd2M+OJv45Bm60/DYunphdV 1U2A== X-Gm-Message-State: AOAM531jYx/WkyK9SVuNYrk8WORSu4DEI3+T87I04VI9yHyIaRgkUYmC Djm7V8Ij4tHNW8VzYKHUJqgq8rFD2TjWmzXM7rW13g== X-Received: by 2002:a05:6512:ac4:: with SMTP id n4mr4929225lfu.237.1631301151579; Fri, 10 Sep 2021 12:12:31 -0700 (PDT) MIME-Version: 1.0 References: <1631147036-13597-1-git-send-email-prakash.sangappa@oracle.com> <3591AC6D-45D2-476A-80B1-46BFA1742602@oracle.com> In-Reply-To: From: Jann Horn Date: Fri, 10 Sep 2021 21:12:05 +0200 Message-ID: Subject: Re: [RESEND RFC PATCH 0/3] Provide fast access to thread specific data To: Peter Oskolkov Cc: Prakash Sangappa , 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 Fri, Sep 10, 2021 at 6:28 PM Peter Oskolkov wrote: > On Fri, Sep 10, 2021 at 9:13 AM Prakash Sangappa > wrote: > > > Do you think your sys_task_getshared can be tweaked to return an > > > arbitrarily-sized block of memory (subject to overall constraints) > > > rather than a fixed number of "options"? > > > > I suppose it could. How big of a size? We don=E2=80=99t want to hold on= to > > arbitrarily large amount of pinned memory. The preference would > > be for the kernel to decide what is going to be shared based on > > what functionality/data sharing is supported. In that sense the size > > is pre defined not something the userspace/application can ask. > > There could be a sysctl or some other mechanism that limits the amount > of memory pinned per mm (or per task). Having "options" hardcoded for > such a generally useful feature seems limiting... That seems like it'll just create trouble a few years down the line when the arbitrarily-chosen limit that nobody is monitoring blows up in someone's production environment. If this area is used for specific per-thread items, then the kernel should be able to enforce that you only allocate as much space as is needed for all threads of the process (based on the maximum number that have ever been running in parallel in the process), right? Which would probably work best if the kernel managed those allocations.