Received: by 2002:a05:6358:3188:b0:123:57c1:9b43 with SMTP id q8csp9378105rwd; Wed, 21 Jun 2023 06:47:43 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ5J14D3aYOjYJDllTH/TMgjRWXemfgXt88X4OoBpX7xJ5+EXgypPQvUI3ya3l5mlLmjuZ2u X-Received: by 2002:a17:902:c941:b0:1b6:6a73:f12a with SMTP id i1-20020a170902c94100b001b66a73f12amr8258705pla.4.1687355263335; Wed, 21 Jun 2023 06:47:43 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1687355263; cv=none; d=google.com; s=arc-20160816; b=eRQzdN0YJeV6qfw+wIGs2L2LzmWoaWOijLK9iMfzhEcl3W+pDDjdQ6HOGZoC7H/4ln Xy7zqpnaQFJoCHTmtDq9BCLQqpf5nBC8DZ7ogw94uUqfl/CKvmIqhtYc8m1V8vFt5El9 7ZwqvjJmMVdXxfjXHIvY8957OrazQWInqLlN9aQTlOHYb/fkP8vfusKeiNFys2vOVYtX wuL367RqtBINqRxObQRIcZKxj+GGvJ5pZKbc37LL56htimp5iEsXUwfZZwAUwdMg3Znk YFBTiKwnIV3m6km9J2TEW/vK3+Pqs1poQVRvgntXZOm53KlB1h+1KUxO/9p5clU7taMj JgWg== 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=EdD6cJh6qu5svt4tCCc88YcqEs1pBBrW5+aY8WHVANw=; b=uBUmVzXQBKgIq4XGC0MXlaHYSWlRnJf2sTKfzQy2S9ocEE1DVCTRdFr4+yqHlfgv4D Zhyq4crn5qCrzZOUx+nOBMXZok0xJb4luio0+jFoZ398rrfvS1T2f2W9f8PwOWAdZVdu Foc0ReH1GlYpaVccN32Du73WnPzWFwLzRi7KskQ949y9CjItjCYKwGrEAzQT62c2nYuI QvOj54sVf3r7TDrpBZZ4NglSP+ycYFcCEta5MI3Qz8e/slBf413do4Z+G1bAX+BgHK0Q 52pCa3RP1tt2p8Ro4L3nV8+BIz0qdXx/wQX4cAnyB+Ww56nTRBLlQ3D4+jhOR893Lios dSXg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@google.com header.s=20221208 header.b=FVWCzeaw; 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 z16-20020a170903019000b001aaf4d2eef6si4438380plg.370.2023.06.21.06.47.28; Wed, 21 Jun 2023 06:47:43 -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=FVWCzeaw; 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 S232599AbjFUN3n (ORCPT + 99 others); Wed, 21 Jun 2023 09:29:43 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:57346 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232593AbjFUN3m (ORCPT ); Wed, 21 Jun 2023 09:29:42 -0400 Received: from mail-wm1-x32f.google.com (mail-wm1-x32f.google.com [IPv6:2a00:1450:4864:20::32f]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 2648119B1 for ; Wed, 21 Jun 2023 06:29:34 -0700 (PDT) Received: by mail-wm1-x32f.google.com with SMTP id 5b1f17b1804b1-3f9b9863bfdso105455e9.1 for ; Wed, 21 Jun 2023 06:29:34 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20221208; t=1687354172; x=1689946172; 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=EdD6cJh6qu5svt4tCCc88YcqEs1pBBrW5+aY8WHVANw=; b=FVWCzeaws/zcBjOjUu1n3j7WTelwG9JXw5CEnSXuVyoExnw46Vm7mXMycj7Ey0QchI UVjgVZ4W3h5G5DyoOoZIhV8s+QLEGIuDiv7FHV5vIOU910wUI0T7BqJIL3hiUULNn3pB VdLBj/gmBNQfPFQVDSrnzVcXK2S0UMtK8OtAgvQT4uoauo/jz+/SpPUkkiLkSsQxZd2z AEO/hNolEPFpBTzv4Bg80pQfyL3BI9NXzGgzGhDMGTnQxEUxqfg/L5oCp96E0x9VwNVo gpzHx1Oy1YyVpGtZNzIKXvRaHqC7XKKGAEWWjdzzHQPIo3iS6lSAwNv8U3KzzfxEcpnE heFg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1687354172; x=1689946172; 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=EdD6cJh6qu5svt4tCCc88YcqEs1pBBrW5+aY8WHVANw=; b=XM36Cehf8XhwCJbJaVvRjxoVYCY49TVVehFhlvNIZVLvP3yHjjN+A7p9akkRKJ5yN2 QgJfAyWAvs1rc1YO/yKECGrofP0UmzhmJeRQDNMqrBXyIRkbohaXwDvErQc1Uq63DEUK yTqJwgGESzZCscoC2znx/WEHjOPDMWYJa6Xx+5JZkwa683/OSqFarlrnhfg2Fh5r445Z b2yfZTtRsfPSs1EuT3+1A35SIGoRMP75PXiBJHqtPmAv9LBFQQk3dyb/9gjevBeutc9I MqEoaCz7YJTui0ko2iW6Prsg5vWtSXoOebsMJwUuKG84FRp8mL14nHGBgO3oDAvEigG7 MXjw== X-Gm-Message-State: AC+VfDwAY8D1WavrImNcmg/CZ+wDYioIgwFztdMXqS2/cPP6jVBdc1p8 c11p7e3PE7rO0WvBAHIqEzeFAR8wqaHau0gMu4CKAw== X-Received: by 2002:a05:600c:3ac9:b0:3f7:3e85:36a with SMTP id d9-20020a05600c3ac900b003f73e85036amr1128926wms.7.1687354172487; Wed, 21 Jun 2023 06:29:32 -0700 (PDT) MIME-Version: 1.0 References: <20230615141144.665148-1-usama.anjum@collabora.com> <20230615141144.665148-3-usama.anjum@collabora.com> <1c1beeda-ceed-fdab-bbf5-1881e0a8b102@collabora.com> In-Reply-To: <1c1beeda-ceed-fdab-bbf5-1881e0a8b102@collabora.com> From: =?UTF-8?B?TWljaGHFgiBNaXJvc8WCYXc=?= Date: Wed, 21 Jun 2023 15:29:20 +0200 Message-ID: Subject: Re: [PATCH v19 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=unavailable 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 Wed, 21 Jun 2023 at 08:35, Muhammad Usama Anjum wrote: > On 6/20/23 11:03=E2=80=AFPM, Andrei Vagin wrote: > ... > >> +struct pagemap_scan_private { > >> + struct page_region *vec_buf, cur_buf; > >> + unsigned long long vec_buf_len, vec_buf_index, max_pages, found_p= ages, flags; > > > > should it be just unsigned long? > These internal values are storing data coming from user in struct > pm_scan_arg in which all variables are 64 bit(__u64) explicitly. This is > why we have unsigned long long here. It is absolutely necessary. vec_buf_len and vec_buf_index can only have values in 0..512 range. flags has only a few lower bits defined (this is checked on ioctl entry) and max_pages can be limited to ULONG_MAX. Actually putting `if (!max_pages || max_pages > ULONG_MAX) max_pages =3D ULONG_MAX` would avoid having to check !max_pages during the walk. Best Regards Micha=C5=82 Miros=C5=82aw