From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by smtp.lore.kernel.org (Postfix) with ESMTP id 2A042ECAAD6 for ; Fri, 26 Aug 2022 08:22:17 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 7012F940008; Fri, 26 Aug 2022 04:22:16 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 689DF940007; Fri, 26 Aug 2022 04:22:16 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 52AB3940008; Fri, 26 Aug 2022 04:22:16 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0017.hostedemail.com [216.40.44.17]) by kanga.kvack.org (Postfix) with ESMTP id 3CC5C940007 for ; Fri, 26 Aug 2022 04:22:16 -0400 (EDT) Received: from smtpin08.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay03.hostedemail.com (Postfix) with ESMTP id 08F10A0E54 for ; Fri, 26 Aug 2022 08:22:16 +0000 (UTC) X-FDA: 79841051472.08.0F25FAC Received: from mail-pl1-f176.google.com (mail-pl1-f176.google.com [209.85.214.176]) by imf07.hostedemail.com (Postfix) with ESMTP id A98804000D for ; Fri, 26 Aug 2022 08:22:15 +0000 (UTC) Received: by mail-pl1-f176.google.com with SMTP id p18so984759plr.8 for ; Fri, 26 Aug 2022 01:22:15 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=content-transfer-encoding:in-reply-to:from:references:cc:to :content-language:subject:user-agent:mime-version:date:message-id :from:to:cc; bh=fbBxa9mjs9/LeuC1VMhijkCQf3EzJL3oe0B8rWAVysQ=; b=ljneAyibOjyTC05FF6LRfcf4yjqy4gzmq8rkiD/zwxZA/iHd4zBVAWAhkVRJ7V8pr+ f04/6gZ4lNPXteJyUUR6WV0ZSB3xd8+yvpSx1lDjW71Nn5u/2aYiCb2B9IJnev/S5AAQ ynWLnSRupPEDX05rNFTnb7a/DWOeFxiYRih5x34K3fBDn2gJvb3CmTc7cBnzuKeiIl5x SqdKLvHUGkogPH0/ZKnHJUPIQ7Y4GwJkZpvhXYHZxB8aGPBo6bvu3E8/jKyz/PVz78Id GJ/1ngJlzLd+KotOBKUrXz+92/SC5Uf3Ix9/VMaAK9raZe8E4PIGkPPkVRAyIDCTpnfX Ci2Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:in-reply-to:from:references:cc:to :content-language:subject:user-agent:mime-version:date:message-id :x-gm-message-state:from:to:cc; bh=fbBxa9mjs9/LeuC1VMhijkCQf3EzJL3oe0B8rWAVysQ=; b=qVFctiJpkHS0mZLYwXOyZ6HBHC4wq9gs/XjmEE98ZV+O9K1vU1FaCMet3DjZHSll2K ESP/K0R2JnAajW1da7OW81fxl/rAB2sO3L/nm6z64cyH43rcZHPQzdeH1LufSvS4C5Jh gXl70/dVIG8a/DwXgpe9HJhCmBUQqi1p1aIq/iVnONkNEwDsmkvVpcFzCrKGBJQjrYmB O+SUkRudh48Qu12VdIT4bEqKBQh0rEODzsoy9WyvoZ43+u9jzAfbNg6xlHsGLuSLsbw6 qp05MfjJeMJSROsZStsFnEKpfNPgFVnuvgsy6Ead6nQXPaU1Xv1d50GJAwuPbZNV84Oa E24A== X-Gm-Message-State: ACgBeo3WZ3RElaYFRZIbcLzcpP5qBP8cbSjLRmVkkZAUU0iDsbsJ5aSJ a6ireWsHABZqcSAmI78pZeY= X-Google-Smtp-Source: AA6agR6iJyn0D0eTSc4C3/t2P0r0WATvM3cuFa/W+c4RXrwLlHoQREeqpitVd1G27l3pppCEmhjjTg== X-Received: by 2002:a17:90a:8415:b0:1fa:ae71:560d with SMTP id j21-20020a17090a841500b001faae71560dmr3230337pjn.191.1661502134566; Fri, 26 Aug 2022 01:22:14 -0700 (PDT) Received: from [192.168.43.80] (subs09a-223-255-225-73.three.co.id. [223.255.225.73]) by smtp.gmail.com with ESMTPSA id n6-20020a170902e54600b0016dbb878f8asm949476plf.82.2022.08.26.01.22.09 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Fri, 26 Aug 2022 01:22:14 -0700 (PDT) Message-ID: Date: Fri, 26 Aug 2022 15:22:08 +0700 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:91.0) Gecko/20100101 Thunderbird/91.13.0 Subject: Re: [PATCH v3 4/4] mm: add documentation of the new ioctl on pagemap Content-Language: en-US To: Muhammad Usama Anjum , Jonathan Corbet , Alexander Viro , Andrew Morton , Shuah Khan , "open list:DOCUMENTATION" , open list , "open list:PROC FILESYSTEM" , "open list:MEMORY MANAGEMENT" , "open list:KERNEL SELFTEST FRAMEWORK" Cc: kernel@collabora.com, Gabriel Krisman Bertazi , David Hildenbrand , Peter Enderborg , Greg KH References: <20220826064535.1941190-1-usama.anjum@collabora.com> <20220826064535.1941190-5-usama.anjum@collabora.com> From: Bagas Sanjaya In-Reply-To: <20220826064535.1941190-5-usama.anjum@collabora.com> Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1661502135; h=from:from:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references:dkim-signature; bh=fbBxa9mjs9/LeuC1VMhijkCQf3EzJL3oe0B8rWAVysQ=; b=jFU7sMu+EwTwdTncAbgH/QF0h0fOIPmIOH+mKA9fFB/JwSvm/MJqJK6iGKD/orEFwEAW4K K8S9VxvWxwaunvrjiaSHieL56kGzJEAP/IPZSxqlSR1aM41Ztxn4Ev8OFuBbzMpIPX2AT8 HaVEAEVwXw/SJTxsC/bI6R+Io6MYNWo= ARC-Authentication-Results: i=1; imf07.hostedemail.com; dkim=pass header.d=gmail.com header.s=20210112 header.b=ljneAyib; spf=pass (imf07.hostedemail.com: domain of bagasdotme@gmail.com designates 209.85.214.176 as permitted sender) smtp.mailfrom=bagasdotme@gmail.com; dmarc=pass (policy=none) header.from=gmail.com ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1661502135; a=rsa-sha256; cv=none; b=i4bszkLGVIgw1xwmaOqS+V+6RUk0nHmdtIsqzk9UUv6fcOSsPKbPIPE7CdndjvorX+m1ue QfHctS5MYGyp9cyjqPgfcMEQUUGv+AeVmT88wuorTfWYhpDYlnWa/3e32JJmX3kpQ4BGa9 jE7Clrz7Ftmu7xSR8H00WMYxA0KpLK8= Authentication-Results: imf07.hostedemail.com; dkim=pass header.d=gmail.com header.s=20210112 header.b=ljneAyib; spf=pass (imf07.hostedemail.com: domain of bagasdotme@gmail.com designates 209.85.214.176 as permitted sender) smtp.mailfrom=bagasdotme@gmail.com; dmarc=pass (policy=none) header.from=gmail.com X-Rspam-User: X-Stat-Signature: kdtnjjfwu6rsyh9buxmz9pftggm41d3e X-Rspamd-Queue-Id: A98804000D X-Rspamd-Server: rspam03 X-HE-Tag: 1661502135-367532 X-Bogosity: Ham, tests=bogofilter, spamicity=0.000000, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: On 8/26/22 13:45, Muhammad Usama Anjum wrote: > The soft-dirty is a bit on a PTE which helps to track which pages a task > -writes to. In order to do this tracking one should > +writes to. > + > +Using Proc FS > +------------- > + > +In order to do this tracking one should > > 1. Clear soft-dirty bits from the task's PTEs. > > @@ -20,6 +25,41 @@ writes to. In order to do this tracking one should > 64-bit qword is the soft-dirty one. If set, the respective PTE was > written to since step 1. > > +Using IOCTL > +----------- > + > +The IOCTL on the ``/proc/PID/pagemap`` can be can be used to find the dirty pages > +atomically. The following commands are supported:: > + > + MEMWATCH_SD_GET > + Get the page offsets which are soft dirty. > + > + MEMWATCH_SD_CLEAR > + Clear the pages which are soft dirty. > + > + MEMWATCH_SD_GET_AND_CLEAR > + Get and clear the pages which are soft dirty. > + Definition lists are enough, no need to use code block. > +The struct :c:type:`pagemap_sd_args` is used as the argument. In this struct: > + > + 1. The range is specified through start and len. The len argument need not be > + the multiple of the page size, but since the information is returned for the > + whole pages, len is effectively rounded up to the next multiple of the page > + size. > + > + 2. The output buffer and size is specified in vec and vec_len. The offsets of > + the dirty pages from start are returned in vec. The ioctl returns when the > + whole range has been searched or vec is completely filled. The whole range > + isn't cleared if vec fills up completely. > + > + 3. The flags can be specified in flags field. Currently only one flag, > + PAGEMAP_SD_NO_REUSED_REGIONS is supported which can be specified to ignore > + the VMA dirty flags for better performance. This flag shows only those pages > + dirty which have been written to by the user. All new allocations aren't returned > + to be dirty. > + > +Explanation > +----------- > > Internally, to do this tracking, the writable bit is cleared from PTEs > when the soft-dirty bit is cleared. So, after this, when the task tries to I'd like to see identifier keywords (such as filename, function and variable name) are consistently formatted either with inline code (``identifier``) or no formatting (all or nothing). -- An old man doll... just what I always wanted! - Clara