Received: by 2002:a05:6358:3188:b0:123:57c1:9b43 with SMTP id q8csp18194453rwd; Tue, 27 Jun 2023 13:07:48 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ7+TO/oxgxS35htwt4cI8LHnSpAYJK40d7TVe4xtlm3k7gtgmq2YvUBH1UdpqTJoofoA200 X-Received: by 2002:a17:906:a290:b0:992:2c39:2d3b with SMTP id i16-20020a170906a29000b009922c392d3bmr1653262ejz.19.1687896468503; Tue, 27 Jun 2023 13:07:48 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1687896468; cv=none; d=google.com; s=arc-20160816; b=pZu22vRSeFjuNRmWbNhfAXkeX3jbBT3ux+csO0Td2GVBH9syWqVodPfH2bNQ/kfDwn G+8hpJokVjHnxfBcy1ONKcj5Abv3diZG/mrK42nC+5c2l6bgO+BlC7TM2uAr80UjSNse QUQxnrvkiEDGzz0mI/ZT06lRjhXrujTT9F2IYGfVboZTXJaTz8Gi4K8F/0pmoD+ibgVr 2+CFDT+mHZ4fZhBxS+BQ5EPoygp9xxm8TPYK+p3owAwFs33Ot6Tno3Ppqra0lNKp8TPH vSy0RzQUQBxlWfgsMqpUG4R1m37XF9m0zpryQyQOaf6ZbI2wxJnNcGnp6F7b57HDL4Yt 7alw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:cc:to:subject :message-id:date:from:in-reply-to:references:mime-version :dkim-signature; bh=oyMtR3cHIPCcrX9Qmw6TUS4exz//e0byqhk5V1sO8fk=; fh=aKXzSaxi2e/+gZtTQRKN59HrSoaWqRVW1+pZ3HZKQ8Y=; b=kt1KbnG/XSaRLwvnJ56f2oN0OghJ267GC7WXJ+7IjU9WHuzke1k6n1IKY0OSvBTpdp lwyfHwFVTRj5BwFmiNh0GVyx/5aqkWixToJI7T7pQdWkk2KmByTXUiNtkh+ySaZd3SaK A2PJoek0BGPr+8hOMIUKcUYufBc2QL2dRF35vkhZ6ptvg/bocnxA56LdQSJVFFeTkFyA 7nrUGSb22ECtNT1Q5RCuOokS47Sy1lpJxylRsUX8OTZHlQZfCLQb5RafTWJX9XnoigMJ jvvF4eDA7ITarlznbATdBi59LPpodNWXxexnGRy8Ay6zfZ7p0n63LuWWsGH/nln+Gydi iR0w== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@google.com header.s=20221208 header.b=2GlDcJSR; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=google.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id oz14-20020a170906cd0e00b0099200e0e481si1798751ejb.43.2023.06.27.13.07.23; Tue, 27 Jun 2023 13:07:48 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@google.com header.s=20221208 header.b=2GlDcJSR; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=google.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230290AbjF0Tyl (ORCPT + 99 others); Tue, 27 Jun 2023 15:54:41 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:57018 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230002AbjF0Tyk (ORCPT ); Tue, 27 Jun 2023 15:54:40 -0400 Received: from mail-ed1-x532.google.com (mail-ed1-x532.google.com [IPv6:2a00:1450:4864:20::532]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id CDDCE10F5 for ; Tue, 27 Jun 2023 12:54:38 -0700 (PDT) Received: by mail-ed1-x532.google.com with SMTP id 4fb4d7f45d1cf-51bcf75c4acso2302a12.0 for ; Tue, 27 Jun 2023 12:54:38 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20221208; t=1687895677; x=1690487677; 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=oyMtR3cHIPCcrX9Qmw6TUS4exz//e0byqhk5V1sO8fk=; b=2GlDcJSRb8Sf7QlZ29iJIG113UXKJ0k1Wa9naaey4i1af+jilqW5+4dt7o2PUwztP8 qSwhqP/3oTAgRj0AcQRNlWBPWJ/huQLNNufJFTIVfvw/jV8xfn/zaSooX2E8S9liVWrD /Km2uLvQvF7E79fOyLLEs8VnIJayGbSyUZEXnMTNp3qB5UVTWVLOzDATNPiM2cwsGr98 oNYmb/B4B4hF556uRQ5jbj3dR3wtEHyyqVJ3tMNLCNxGc/qRbLE4qlrv/z5nLj04TwRm DyH9PJxxM0BA/Iz2E2HgJuGE5E7bvTC1ptTtc5lwuC7OHDm7ZeK51zGvoD4Hvwe0iaSd KljQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1687895677; x=1690487677; 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=oyMtR3cHIPCcrX9Qmw6TUS4exz//e0byqhk5V1sO8fk=; b=MBS8GYuZ7gAy6uDtwpDvxoZhOa19N8CT1pX30YdjDCLVCSnwNYcKfa51nj4eIMBxmY zUzOG8MAbJS79f5JVIsYJPVc7kanJGUIpl7i5wZY5y8okmuRQTWGqoEmhGpOgr3WlUWz Bj3zzgzdGlBw1oYfxusfvyu5GK+yn4dnlR2vnSvfmk92lisS43Ts8jmb2bvJoPaXc7yF rq3t7yXmqFfBRyTe+u7Vijk2bBaquIq8ZqV54FN5DTCeQruzMlFkPh8bv+aTUyqadbQT aXVMf76cawxFNjPVOfagc36Dnc7w7wbdBLBE8an/lsWA2x51Fm8ubJ2mVpmQjBEZbVjv OkyA== X-Gm-Message-State: AC+VfDw/wikRfcy7CwoLivaTDuO19cYNU8lb14lN3m3P0sroAiPryjV5 494hcgHTYJIKo9vIb0O8PpTohwBsm2Ym9/MzXtM54g== X-Received: by 2002:a50:99d0:0:b0:519:7d2:e256 with SMTP id n16-20020a5099d0000000b0051907d2e256mr14597edb.0.1687895677218; Tue, 27 Jun 2023 12:54:37 -0700 (PDT) MIME-Version: 1.0 References: <20230626113156.1274521-1-usama.anjum@collabora.com> <20230626113156.1274521-3-usama.anjum@collabora.com> <13ea54c0-25a3-285c-f47e-d6da11c91795@collabora.com> <6ac9c60e-0a6b-110a-cace-97afbd9708a0@collabora.com> In-Reply-To: <6ac9c60e-0a6b-110a-cace-97afbd9708a0@collabora.com> From: =?UTF-8?B?TWljaGHFgiBNaXJvc8WCYXc=?= Date: Tue, 27 Jun 2023 21:54:25 +0200 Message-ID: Subject: Re: [PATCH v21 2/5] fs/proc/task_mmu: Implement IOCTL to get and optionally clear info about PTEs To: Muhammad Usama Anjum Cc: Andrei Vagin , Peter Xu , David Hildenbrand , Andrew Morton , Danylo Mocherniuk , Paul Gofman , Cyrill Gorcunov , Mike Rapoport , Nadav Amit , Alexander Viro , Shuah Khan , Christian Brauner , Yang Shi , Vlastimil Babka , "Liam R . Howlett" , Yun Zhou , Suren Baghdasaryan , Alex Sierra , Matthew Wilcox , Pasha Tatashin , 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 X-Spam-Status: No, score=-17.6 required=5.0 tests=BAYES_00,DKIMWL_WL_MED, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF, ENV_AND_HDR_SPF_MATCH,RCVD_IN_DNSWL_NONE,SPF_HELO_NONE,SPF_PASS, T_SCC_BODY_TEXT_LINE,USER_IN_DEF_DKIM_WL,USER_IN_DEF_SPF_WL autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Tue, 27 Jun 2023 at 21:20, Muhammad Usama Anjum wrote: > Thanks Micha=C5=82 for replying. > > On 6/27/23 11:52=E2=80=AFPM, Micha=C5=82 Miros=C5=82aw wrote: > > On Tue, 27 Jun 2023 at 11:00, Muhammad Usama Anjum > > wrote: > >> > >> Hi Andrei and Michal, > >> > >> Lets resolve last two points. Please reply below. > >> > >> On 6/27/23 6:46=E2=80=AFAM, Andrei Vagin wrote: > > [...] > >>> And we need to report an address where it stopped scanning. > >>> We can do that by adding zero length vector. > >> I don't want to do multiplexing the ending address in vec. Can we add > >> end_addr variable in struct pm_scan_arg to always return the ending ad= dress? > >> > >> struct pm_scan_arg { > >> ... > >> _u64 end_addr; > >> }; > > > > The idea to emit a zero-length entry for the end looks nice. This has > > the disadvantage that we'd need to either reserve one entry for the > > ending marker or stop the walk after the last entry is no longer > > matching. > This is ambiguous. Can you explain? Both solutions would allow to return the restart point back to the caller (the second one would need to stop the walk as soon as the matching page range finishes -- that creates discontinuity). > > Another solution would be to rewrite 'start' and 'len'. The caller > > would be forced to use non-const `pm_scan_arg`, but I expect the `vec` > > pointer would normally be written anyway (unless using only a > > statically-allocated buffer). > > Also, if the 'len' is replaced with 'end' that would make the ioctl > > easily restartable (just call again if start !=3D end). > Nice idea. But returning ending address in len seems a bit strange. I mean that it would update `start` =3D start value for next call' and `len` =3D `len` - (new `start` - original `start`). By replacing `len` I meant to remove the field and add `end` instead to make the requested range use begin .. end (iterator range) style instead of start + len (buffer and length). In this version you only need to update `start` (or `begin` if you prefer). Best Regards Micha=C5=82 Miros=C5=82aw