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 D641DC433FE for ; Tue, 18 Oct 2022 11:11:39 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 136576B0072; Tue, 18 Oct 2022 07:11:39 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 0E6EE6B0075; Tue, 18 Oct 2022 07:11:39 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id EF0686B0078; Tue, 18 Oct 2022 07:11:38 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0015.hostedemail.com [216.40.44.15]) by kanga.kvack.org (Postfix) with ESMTP id E0C546B0072 for ; Tue, 18 Oct 2022 07:11:38 -0400 (EDT) Received: from smtpin12.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay07.hostedemail.com (Postfix) with ESMTP id AAEF21606DC for ; Tue, 18 Oct 2022 11:11:38 +0000 (UTC) X-FDA: 80033804676.12.A6C0229 Received: from mail-lf1-f44.google.com (mail-lf1-f44.google.com [209.85.167.44]) by imf16.hostedemail.com (Postfix) with ESMTP id 269AF18002D for ; Tue, 18 Oct 2022 11:11:37 +0000 (UTC) Received: by mail-lf1-f44.google.com with SMTP id g1so21901319lfu.12 for ; Tue, 18 Oct 2022 04:11:37 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20210112; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:from:to:cc:subject:date :message-id:reply-to; bh=UsmuVvzUGL/tIXDCMMq9mrTS5g/NHatso0iO2PBAdX8=; b=hWb9clTWPGU/bF/813AdOTEHipmOUGOlMr2CwDFf3xzqyrXgR/WYXA9gGn2hPgOcWk ak4xBbJGG0+EERjIzkWEKFhN6wbpA/RyaosLmxDmfeNFO4te7aoM8V+Vr7g/0g9Mxcia bwg4aDc1NuUpXhRtLOHi+OR4aD9ZF4iKQyO6Oy6oOCeLvZd69ykxCxfZqXoTHTgCqrW+ 1KseqYoX7CaDuHWaCRII+oWowWc6dzInR8yfBBRNLUlvNpaq0FXbcMUFix9NfAqr8S2+ /yBarw4tOK+F1Y7yOz29uRPbK4KJyhjGlV9iMnaSraIvkvFKYW/2tWp8wOlDH/+TTyhk rbmg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=UsmuVvzUGL/tIXDCMMq9mrTS5g/NHatso0iO2PBAdX8=; b=JkchALjHdUkbqY9WREdRMbfJ5UI217lHa2rK4SicZ/QpV9cpH/I1XGILcRBCaSjh14 UBFcNYD61C96B0AeEC3cpLqVvPSuJfP9UCBGdQIWvtQhb+ac2m/qspCL5JvPdjzodQAK N7pTXvukTMAq1M4VU1vYfMYVNF2iSk3xHzwphvVBVvPanEQZFXm7C01TTzoVuwpezYSZ dhYCze2HZY3SIGBuq4K0R0n5EMvZJiSAkja9GaskTXYevnfgLdgnFQpufGhSVnwoUSnq IwjXSOrXc7CfCMU3i37D6kdylgGJdPBPWA3QfV2ElC7K8NDMIexbTqW7yGUkNp8G8n+e idmw== X-Gm-Message-State: ACrzQf1zNuSiTyp3x4EOvdDHnZuKyXBYMb4FAZh7eaAfLJR37dXJIjk9 g+6czNbTcaohAcRQTwC9JMXRO7+aDNgfaR3GFJPiww== X-Google-Smtp-Source: AMsMyM5zbA7ZF2jb5PoA/bKYc2t4oy6VFFv73a9+vbUT3G6aSSPbo59D9h1fv/pw7uv73bg6BtTdL1xm1wa4gqam5/w= X-Received: by 2002:ac2:5445:0:b0:4a4:3c5c:f73 with SMTP id d5-20020ac25445000000b004a43c5c0f73mr778245lfn.21.1666091496376; Tue, 18 Oct 2022 04:11:36 -0700 (PDT) MIME-Version: 1.0 References: <20221014134802.1361436-1-mdanylo@google.com> <474513c0-4ff9-7978-9d77-839fe775d04c@collabora.com> In-Reply-To: <474513c0-4ff9-7978-9d77-839fe775d04c@collabora.com> From: =?UTF-8?B?TWljaGHFgiBNaXJvc8WCYXc=?= Date: Tue, 18 Oct 2022 13:11:25 +0200 Message-ID: Subject: Re: [PATCH v3 0/4] Implement IOCTL to get and clear soft dirty PTE To: Muhammad Usama Anjum Cc: Danylo Mocherniuk , avagin@gmail.com, linux-mm@kvack.org, akpm@linux-foundation.org, gregkh@linuxfoundation.org, corbet@lwn.net, david@redhat.com, kernel@collabora.com, krisman@collabora.com, linux-doc@vger.kernel.org, linux-fsdevel@vger.kernel.org, linux-kernel@vger.kernel.org, linux-kselftest@vger.kernel.org, peter.enderborg@sony.com, shuah@kernel.org, viro@zeniv.linux.org.uk, willy@infradead.org, figiel@google.com, kyurtsever@google.com, Paul Gofman , surenb@google.com Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1666091498; 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=UsmuVvzUGL/tIXDCMMq9mrTS5g/NHatso0iO2PBAdX8=; b=uWDmrU3X3qEx5IejugssdTtwAiWcIt5WjVNKrMovmhJyOhW8Qbrfa/Nah5SXcXRcN0Woap D67jJwqGJAG8ZAw9qpLIFXo4SoPYv5fr7B9fdrj0K7sXDFskJkwrNIhCrNpP0q8ZfxgPhi hbEbpym6pCazy2s6dOO1OfTOETc3gKA= ARC-Authentication-Results: i=1; imf16.hostedemail.com; dkim=pass header.d=google.com header.s=20210112 header.b=hWb9clTW; spf=pass (imf16.hostedemail.com: domain of emmir@google.com designates 209.85.167.44 as permitted sender) smtp.mailfrom=emmir@google.com; dmarc=pass (policy=reject) header.from=google.com ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1666091498; a=rsa-sha256; cv=none; b=2sVK29+gjdz67YBUCUfPpEV6J2GQtsSo3h7mSw8/DPNAnDfnxXz9HqqtIMCOwnM8UYbLNX X0NZgx8JOiO+s1LAvb0RRwaPIq/HDI4TZEIug4B5WGZFlMzI6rG/pTGdQKjI406GXlXISe 61ZVB3eFFjN3/pD+lS4YpyfVA80gXF0= Authentication-Results: imf16.hostedemail.com; dkim=pass header.d=google.com header.s=20210112 header.b=hWb9clTW; spf=pass (imf16.hostedemail.com: domain of emmir@google.com designates 209.85.167.44 as permitted sender) smtp.mailfrom=emmir@google.com; dmarc=pass (policy=reject) header.from=google.com X-Stat-Signature: s48w351194r5aghcr1mgbik8t56oekx6 X-Rspamd-Queue-Id: 269AF18002D X-Rspam-User: X-Rspamd-Server: rspam04 X-HE-Tag: 1666091497-714483 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 Tue, 18 Oct 2022 at 12:36, Muhammad Usama Anjum wrote: [...] > I've included the masks which the CRIU developers have specified. > max_out_page is another new optional variable which is needed to > terminate the operation without visiting all the pages after finding the > max_out_page number of desired pages. There is no way to terminate the > operation without this variable. > > How does the interface looks now? Please comment. > > /* PAGEMAP IOCTL */ > #define PAGEMAP_GET _IOWR('f', 16, struct pagemap_sd_args) > #define PAGEMAP_CLEAR _IOWR('f', 17, struct pagemap_sd_args) > #define PAGEMAP_GET_AND_CLEAR _IOWR('f', 18, struct pagemap_sd_args) Why are three IOCTLs needed? Could CLEAR be a flag (like the PAGEMAP_NO_REUSED_REGIONS) or 'cmask' and GET be implied when vec !=3D NULL? > /* Bits are set in the bitmap of the page_region and masks in > pagemap_sd_args */ > #define PAGE_IS_SD 1 << 0 > #define PAGE_IS_FILE 1 << 1 > #define PAGE_IS_PRESENT 1 << 2 > #define PAGE_IS_SWAPED 1 << 3 > > /** > * struct page_region - Page region with bitmap flags > * @start: Start of the region > * @len: Length of the region > * bitmap: Bits sets for the region > */ > struct page_region { > __u64 start; > __u64 len; > __u64 bitmap; > }; Could you explain what units start and len are using? Are they bytes or pages (what size)? > /** > * struct pagemap_sd_args - Soft-dirty IOCTL argument Nit: it's not soft-dirty-specific anymore. Maybe "pagemap_scan_args"? > * @start: Starting address > * @len: Length of the region > * @vec: Output page_region struct array > * @vec_len: Length of the page_region struct array > * @max_out_page: Optional max output pages (It must be less than > vec_len if specified) Why is it required to be less than vec_len? vec_len effectively specifies max number of ranges to find, and this new additional field counts pages, I suppose? BTW, if we count pages, then what size of them? Maybe using bytes (matching start/len fields) would be more consistent? > * @flags: Special flags for the IOCTL > * @rmask: Special flags for the IOCTL > * @amask: Special flags for the IOCTL > * @emask: Special flags for the IOCTL > * @__reserved: Reserved member to preserve data alignmen= t. Must be 0. > */ > struct pagemap_sd_args { > __u64 __user start; > __u64 len; > __u64 __user vec; // page_region > __u64 vec_len; // sizeof(page_region) > __u32 flags; // special flags > __u32 rmask; > __u32 amask; > __u32 emask; > __u32 max_out_page; > __u32 __reserved; > }; > > /* Special flags */ > #define PAGEMAP_NO_REUSED_REGIONS 0x1 What does this flag do? Best Regards Micha=C5=82 Miros=C5=82aw