Received: by 2002:a25:4158:0:0:0:0:0 with SMTP id o85csp118122yba; Thu, 25 Apr 2019 19:19:25 -0700 (PDT) X-Google-Smtp-Source: APXvYqy9VrWTS1+uGca9T2HOsBvuJSQdvtllDpzNITBtnHgwChIjpWSXEEOFOaXYy7noVhyr42ZW X-Received: by 2002:a65:6294:: with SMTP id f20mr40372480pgv.415.1556245165852; Thu, 25 Apr 2019 19:19:25 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1556245165; cv=none; d=google.com; s=arc-20160816; b=oMig57K4iZsjwAYZli/fa9qZK1BIrGf13/LZ/4g6AxCqkatK+WI+zWiq2bcHd+jZux PG+QAg8wxCxVDG+xVhDoOsQ7pmZG4trnFyVr0LVFdYHkbYak+S3Io7V5AQw3ZufQW2xq rA2Mh1JHLntAMwK6Ihwqin+Gp2EJyvnpdP3CX8BIx8XMOhfLVGVrbyCtS61txCY3wWu7 YnJGew4e3SHEPapi95rBnhxt6jtp+Y0Eg/YrwGCR6Xl3wT5pRnrC6vTPTS0ErY+wwv1D 0ylVQIXMgqr3Nk/IzWgnupC4syY6QJRZdGL0JMLlD0EJ6LnxrbTyT1qpMGIN7/7lYmyE jBqw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:in-reply-to :content-disposition:mime-version:references:message-id:subject:cc :to:from:date:dkim-signature; bh=RCm/SsERIu5HE9v6F9X9JLKKd3B3OYA0dhgGVRMKun0=; b=qbXMA+MnmPWXM28+NTEq/DP0VtYUtZ1ZVAQpWff1hNI7hm3BXurQNvtrEN+wFK2AAV +jBleNNAxaTam5nQJC5Q3tdwa1qjDSjbS4JbLSpw4rEcvIvcaNMUJpeg+0YcqctpcYug VmsZ4zFZfjL0m8RKDdCBLvxtmbwbGKjP1pqpypPvsMUer6Plx8GrmT7y9+HtS9y5ujD7 C1uk71jsN14NW/pb63htz1ISvQEeMkiXamVA5tADmly4QaLBoqmHb8Wi4UZWBE0xMsug U8uyu3GfPq9pj3BHqhahND55YSDVsdZURITO1V+F9DHqOtZOcOmpt02//PBy+ofD9sJs LW/g== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=STrLaDSE; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 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. [209.132.180.67]) by mx.google.com with ESMTP id o6si17356813pgn.407.2019.04.25.19.19.10; Thu, 25 Apr 2019 19:19:25 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=STrLaDSE; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 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 S1731415AbfDYWB5 (ORCPT + 99 others); Thu, 25 Apr 2019 18:01:57 -0400 Received: from mail-lf1-f65.google.com ([209.85.167.65]:35417 "EHLO mail-lf1-f65.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1730893AbfDYWB5 (ORCPT ); Thu, 25 Apr 2019 18:01:57 -0400 Received: by mail-lf1-f65.google.com with SMTP id j20so952572lfh.2; Thu, 25 Apr 2019 15:01:55 -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:references:mime-version :content-disposition:in-reply-to:user-agent; bh=RCm/SsERIu5HE9v6F9X9JLKKd3B3OYA0dhgGVRMKun0=; b=STrLaDSEjlNf1gehRI44rC8t9dNR+UofnOwrDv8nbs5WjN7usAS0IXkQHZ2CLb1VAA X6poZ7Xfvex1g8aNsRUDToc8bv+Lx6mV2qhZVRTZPvmuP3INJfxshXfrQvHsAGjsKVp9 yIrqccjVmaYD9KrC91aQboB4ELxAd7PwYanhNiz6xNSXe2nNnICxL8ep1i/6BQnzS6iH zqwFcd3vWWzVz9Q3Dlp+GdrfDbYbewqOFTZ1gChv7Ko4VHvpfhrp3dNck6MvDbf534us u3DW2Yqb5PiAYm6kkgodvqhjSeZaXZgHCVqZmPurxsuBPOTBLZFn7I3xL+Eflg+2EHMs +0Pw== 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:references :mime-version:content-disposition:in-reply-to:user-agent; bh=RCm/SsERIu5HE9v6F9X9JLKKd3B3OYA0dhgGVRMKun0=; b=A6pG+VUO/zE+YTdgkaJHhd3ORXHcmljMPRaBP9IpGAILKxsthxcwtLCm9hASQT7ToH 3kVZBL6m19RgajmcA0gjGcotmT3Gzz1OBmB3fRnWrHMvS/A9F4AB9+kAtTu4g7fci/Kx 2Px81m5mD+ZcqY6X2lndjt334VheQzt3sewTjRL/IF8+XSltLfSjoPNHqtX8LqRNRXNs mVCmo81I7DiFFriQKlc5YbhWpiNMDUuyvQW5YuVyC5ahuq786J4M9hxGDNCRyIC4gJeQ ZtbBvpCE87+pJ4DIpJEABU9hugQRtvIqL+3IXl3U8gkF9UtaJWcyeVR2J51kdBF1edOK wK5w== X-Gm-Message-State: APjAAAVYYYjWpCGZfy1lsbd8fI1HZAFJ5caG2b0o78g5q0fwSvbBF5o+ xVe8Y3fdEDdKY1mM8gOPqA== X-Received: by 2002:ac2:592b:: with SMTP id v11mr22567622lfi.85.1556229715155; Thu, 25 Apr 2019 15:01:55 -0700 (PDT) Received: from avx2 ([46.53.240.140]) by smtp.gmail.com with ESMTPSA id f25sm5220348lfc.46.2019.04.25.15.01.53 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 25 Apr 2019 15:01:54 -0700 (PDT) Date: Fri, 26 Apr 2019 01:01:51 +0300 From: Alexey Dobriyan To: Joel Savitz Cc: linux-kernel@vger.kernel.org, Andrew Morton , Vlastimil Babka , "Aneesh Kumar K.V" , Michael Ellerman , Ram Pai , Andrea Arcangeli , Huang Ying , Sandeep Patil , Rafael Aquini , linux-fsdevel@vger.kernel.org Subject: Re: [PATCH] fs/proc: add VmTaskSize field to /proc/$$/status Message-ID: <20190425220151.GA27445@avx2> References: <1556225867-458-1-git-send-email-jsavitz@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline In-Reply-To: <1556225867-458-1-git-send-email-jsavitz@redhat.com> User-Agent: Mutt/1.10.1 (2018-07-13) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Thu, Apr 25, 2019 at 04:57:47PM -0400, Joel Savitz wrote: > Currently, there is no fast mechanism to get the virtual memory size of > the current process from userspace. > --- a/fs/proc/task_mmu.c > +++ b/fs/proc/task_mmu.c > @@ -74,7 +74,10 @@ void task_mem(struct seq_file *m, struct mm_struct *mm) > seq_put_decimal_ull_width(m, > " kB\nVmPTE:\t", mm_pgtables_bytes(mm) >> 10, 8); > SEQ_PUT_DEC(" kB\nVmSwap:\t", swap); > - seq_puts(m, " kB\n"); > + SEQ_PUT_DEC(" kB\nVmSwap:\t", swap); > + seq_put_decimal_ull_width(m, > + " kB\nVmTaskSize:\t", TASK_SIZE >> 10, 8); > + seq_puts(m, " kB\n"); TASK_SIZE accesses "current", while this function accesses any ->mm. Can you turn this into prctl(2) aka "current" refugee camp?