Received: by 2002:a05:6a10:22f:0:0:0:0 with SMTP id 15csp3454912pxk; Mon, 28 Sep 2020 19:07:25 -0700 (PDT) X-Google-Smtp-Source: ABdhPJw8a2AvVDbLADnPgtBcNa7xiPzIFAlHf+KyKkrs+d6hAteL8dAgZyKWljAhpj0DhuZuVkN3 X-Received: by 2002:aa7:c1c3:: with SMTP id d3mr908086edp.228.1601345245015; Mon, 28 Sep 2020 19:07:25 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1601345245; cv=none; d=google.com; s=arc-20160816; b=JlMY6dtaFn6hbzBMNAIB//68p+R3XjxDPmv3YeH7BQGOBhXbJGYZA1pJWa+pBw5//I eAa/X+7PqbgMoxo44rwyEazdlSW2sqIhJbutmBtGTtBNN4YpnzvqA8Y/LzbLuVIS0vwu bGz587PyVW5e21DTNEjov3X9p/Z/AezTZzabSsRx4y+6w5NbVHguFskH4uK81iAkkcub V0g3Ne+IceOzhvx2xY5GTnVdLK40ExGXyjImOmVt0IkyLazfYVkdkdIgpaB3Cn8qW7NP iYwpPzekghlXjVr4O9DFI/sd+xw0aNqKcm9DlGZWMJDjcoTc/g1Gg20+3D5SoAumUQE8 GaLQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-disposition:mime-version:message-id :subject:cc:to:from:date:dkim-signature; bh=iG/bDnzqe0Ijt5t+Wte/8y83V66TpQLjZGlUCfab1wM=; b=nolMf5USj0lEsb0aOVHJ0bEi1p4KrCEQSbIytQXTP/kRnrWrN0vY0yIHAT6z5wERZE VnAPydSr6z8JFKJBS7V57oiA4Q0bPTQ3k2P8aBlFseUgX7+Lbm5HuHAY0phPNMuaWloM Gz9R85X16ic291bgbo+mNDTkToDW7U2JToodW8sEx/RIwHv9lMhxgKooE2NQVn4pORvr csvlPw/4tt+pPN5Lbgwu3XJfBsO9QPTVYs13txUJhulfO4YGZA9PoCSAhCau2erZ5VkH iRSCBzzuKKoBwc83oNzRzIvaCzSujyQfuJzCo8Ss9sNbpvUJdvUPm9x48fTUyQjPfb0I nSjQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=EpFofk08; 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 p23si1764536ejw.12.2020.09.28.19.06.57; Mon, 28 Sep 2020 19:07:25 -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=EpFofk08; 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 S1727309AbgI2CFX (ORCPT + 99 others); Mon, 28 Sep 2020 22:05:23 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:34658 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726961AbgI2CFX (ORCPT ); Mon, 28 Sep 2020 22:05:23 -0400 Received: from mail-pj1-x1031.google.com (mail-pj1-x1031.google.com [IPv6:2607:f8b0:4864:20::1031]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 75534C061755; Mon, 28 Sep 2020 19:05:23 -0700 (PDT) Received: by mail-pj1-x1031.google.com with SMTP id jw11so1819390pjb.0; Mon, 28 Sep 2020 19:05:23 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=date:from:to:cc:subject:message-id:mime-version:content-disposition; bh=iG/bDnzqe0Ijt5t+Wte/8y83V66TpQLjZGlUCfab1wM=; b=EpFofk08+f9XITxoematI1OddFtlpiCUaEhRU1X8Rf3an9Wf7Z359hgUmUFpbHoPlP 8RxfGcHxl0ll7p8Vv9aC0nB8jAe7BcKRPgFm1MJIUV9iNEvpimIJEC0XLsnt1/o09PcF +GLVK5dBh3fVli5MWTsCkWGgNgmhoTdolAxDXRIiqkfMi4eimOGaYCGATR+SVIHdsRRe 9mlew9d5gcr78P46fZ8EGcWjjz6bnPhryLd+yC3/II6dTOxBQ5NLB2GCCaAyLRCPKYv2 rPd5QHyrYZI4Q/h2/BO7k4yYlBisKMqi/mF5QSB++gKtFHSyPRDoj4d0X7CICgzyDec8 3y1w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:message-id:mime-version :content-disposition; bh=iG/bDnzqe0Ijt5t+Wte/8y83V66TpQLjZGlUCfab1wM=; b=GITYyTXUu+joFGvxRbVicd6Joh7V+S65i8Y7o5GMxQXRMgkTcgAJnp6sV/CMQT8aCc nz81fKNIjj/lb7LZyxbNBISV7i+EBfPbHDrIDOiyBG7cvEZxqG3unU8970sxcQbHorh9 llFOdSndaaBrAHv7n2y6KNwIPjkDDdkiZHpqp3bbnqGKQFQH1pkowTASlndsaJ3O6kvR 3tKYyTx6/mpDHmdcM49DoTolEN+u0MRSdbLMv/9bcv9CrxbjUlSwU4A9aLVWNpL5FnUz v9xBkXd90zoNkNTRyKBIe0meUhkSoU1NvXar4oW2KRaXxG55i9W0VeVlc+Uxd2JHbRK9 xTvg== X-Gm-Message-State: AOAM532U/T+5RrMs5foNiMAFUVI2buskkbGLMQUuvntLqucLnSxWjS+l NJZ4PF/6OdTcLTghSA0DOjE= X-Received: by 2002:a17:90a:c255:: with SMTP id d21mr1857806pjx.212.1601345122954; Mon, 28 Sep 2020 19:05:22 -0700 (PDT) Received: from localhost ([2409:10:2e40:5100:6e29:95ff:fe2d:8f34]) by smtp.gmail.com with ESMTPSA id 31sm2577845pgs.59.2020.09.28.19.05.20 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 28 Sep 2020 19:05:21 -0700 (PDT) Date: Tue, 29 Sep 2020 11:05:20 +0900 From: Sergey Senozhatsky To: Alexey Dobriyan , Andrew Morton , Vlastimil Babka , Kees Cook , Matthew Wilcox Cc: linux-kernel@vger.kernel.org, linux-fsdevel@vger.kernel.org, Sergey Senozhatsky Subject: [RFC] process /proc/PID/smaps vs /proc/PID/smaps_rollup Message-ID: <20200929020520.GC871730@jagdpanzerIV.localdomain> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Hello, One of our unprivileged daemon process needs process PSS info. That info is usually available in /proc/PID/smaps on per-vma basis, on in /proc/PID/smaps_rollup as a bunch of accumulated per-vma values. The latter one is much faster and simpler to get, but, unlike smaps, smaps_rollup requires PTRACE_MODE_READ, which we don't want to grant to our unprivileged daemon. So the question is - can we get, somehow, accumulated PSS info from a non-privileged process? (Iterating through all process' smaps vma-s consumes quite a bit of CPU time). This is related to another question - why do smaps and smaps_rollup have different permission requirements? -ss