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 vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 57D34C64EC4 for ; Fri, 17 Feb 2023 15:19:09 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230306AbjBQPTH (ORCPT ); Fri, 17 Feb 2023 10:19:07 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:51564 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230297AbjBQPTE (ORCPT ); Fri, 17 Feb 2023 10:19:04 -0500 Received: from mail-ed1-x52b.google.com (mail-ed1-x52b.google.com [IPv6:2a00:1450:4864:20::52b]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 44FD4718CC for ; Fri, 17 Feb 2023 07:19:01 -0800 (PST) Received: by mail-ed1-x52b.google.com with SMTP id ee31so7039430edb.3 for ; Fri, 17 Feb 2023 07:19:00 -0800 (PST) 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=FU0XLrtzMAKjlRYy7HgclTRxusFFqyOt4HUxHYauwNc=; b=ClA2++cyEmWIvrCX/JLkk1qEq68q05a7YodtcNV8zGQp1BNgn63XDxPeGO7ySUcDYu d/BePzI2UZKdbMBHeF/uusiEID2WsgF/lI0ZO0877Ps7RzA86sMfjjc1Z3Khofm4S0v8 KkPGTDYEIR3Dxr25JpZ4QoJAXrpm2d2qU343QGPZOx/rqhd+s5q4LvOrP06XV3EobMI4 Y0Y5hq1fKFB9aU2sdTAL7uSoo9pGWeekuKrycc5FhIEWiP/VLCsAayu90Nvtw+OYrhBN L8xmKmDLgZpok4Nfhs2ZMXm6azC0AeyitLgDGNi3iJS2nEB4vZskhWphpKChMmYyxShV RLMA== 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=FU0XLrtzMAKjlRYy7HgclTRxusFFqyOt4HUxHYauwNc=; b=WpXoxmmGK1TK5XG/ZR91aOUMiPPlAz4AfBXPVZmQKV8B069HogT+McfThUkJUpOYQq r7rQZOLq+31t6Hku8xaA/UMxf7Iy5FJknuUj08+EO+gFvJIlzHTHOckBW7DXiOY7+xDl ABhC6OySuNW1To8lLcu6IvSkEKgnzzB+T4491f3nwRjK4Y3QGU9chut0Rsvpy4xW+91H TZdgNkmQ8LOUeaIcYMJ/XHpOwXobJXhM/A9H0ImiM922UvKIpMBPS3VjlEUORjJ6Vy9x lVtKpCq23uLBeaNteKpYaEqgpq2D1JElSU2s1C7rjLr85AQga7ywC7TgM+gCYPZzf2f8 kKBA== X-Gm-Message-State: AO0yUKXLSw+M3GpUulkIdj1kd/DofpGyOEUf/T2C319b02FWsIuNEhKo LdAgoUsjER6eloDGqBm2wbA1yUvnC89XyZiNASwSwQ== X-Google-Smtp-Source: AK7set+sX96S/Lh1UKWLv7UWH9jx5/d5nrpnfKpxlGGC/JiPWb4tlRxD5PVoIjiClVPuLTYAaerKW4sYVYIH/ehhHR0= X-Received: by 2002:a17:906:48c9:b0:8ae:9f1e:a1c5 with SMTP id d9-20020a17090648c900b008ae9f1ea1c5mr525133ejt.3.1676647139268; Fri, 17 Feb 2023 07:18:59 -0800 (PST) MIME-Version: 1.0 References: <20230202112915.867409-1-usama.anjum@collabora.com> <20230202112915.867409-4-usama.anjum@collabora.com> In-Reply-To: <20230202112915.867409-4-usama.anjum@collabora.com> From: =?UTF-8?B?TWljaGHFgiBNaXJvc8WCYXc=?= Date: Fri, 17 Feb 2023 16:18:47 +0100 Message-ID: Subject: Re: [PATCH v10 3/6] fs/proc/task_mmu: Implement IOCTL to get and/or the clear info about PTEs To: Muhammad Usama Anjum Cc: Peter Xu , David Hildenbrand , Andrew Morton , Andrei Vagin , Danylo Mocherniuk , Paul Gofman , Cyrill Gorcunov , Alexander Viro , Shuah Khan , Christian Brauner , Yang Shi , Vlastimil Babka , "Liam R . Howlett" , Yun Zhou , Suren Baghdasaryan , Alex Sierra , Matthew Wilcox , Pasha Tatashin , Mike Rapoport , Nadav Amit , Axel Rasmussen , "Gustavo A . R . Silva" , Dan Williams , linux-kernel@vger.kernel.org, linux-fsdevel@vger.kernel.org, linux-mm@kvack.org, linux-kselftest@vger.kernel.org, Greg KH , kernel@collabora.com 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 Thu, 2 Feb 2023 at 12:30, Muhammad Usama Anjum wrote: [...] > - The masks are specified in required_mask, anyof_mask, excluded_ mask > and return_mask. [...] May I suggest a slightly modified interface for the flags? As I understand, the return_mask is what is applied to page flags to aggregate the list. This is a separate thing, and I think it doesn't need changes except maybe an improvement in the documentation and visual distinction. For the page-selection mechanism, currently required_mask and excluded_mask have conflicting responsibilities. I suggest to rework that to: 1. negated_flags: page flags which are to be negated before applying the page selection using following masks; 2. required_flags: flags which all have to be set in the (negation-applied) page flags; 3. anyof_flags: flags of which at least one has to be set in the (negation-applied) page flags; IOW, the resulting algorithm would be: tested_flags =3D page_flags ^ negated_flags; if (~tested_flags & required_flags) skip page; if (!(tested_flags & anyof_flags)) skip_page; aggregate_on(page_flags & return_flags); Best Regards Micha=C5=82 Miros=C5=82aw