Received: by 2002:a05:6358:3188:b0:123:57c1:9b43 with SMTP id q8csp10672772rwd; Thu, 22 Jun 2023 03:17:06 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ4g0r9wO1pe4MPuwK0iQ48cUqvGwo9j456KMkaL1PQ9c5Hk2lQKwvPog9MsLQa5r3pboMN9 X-Received: by 2002:a17:902:ea8a:b0:1b2:5ade:9ebb with SMTP id x10-20020a170902ea8a00b001b25ade9ebbmr11544460plb.2.1687429026141; Thu, 22 Jun 2023 03:17:06 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1687429026; cv=none; d=google.com; s=arc-20160816; b=TMGHK//gHW96OJMdDxLGMQt/E147Hfqf6Auz5xcBCFO7cXNW5QZC3ky8Xr9YEl4XOz XV4p9WenE+9WtR7U1kWXTk0byCE3XSYsc2fwVWP+2XU1V4LQwbqI0p6pGsGL/NDo6K1g 0ntux+OLCMCthuQGzoDKvpWEkuP6FKwRrIwPDSnVDTpp9sLI4AT5NKIe8k9FdmkV2Ucv wnn3JKtItTagp08F8Yc8qp/sdk0tuHYzCr/9vz7/hkHaWHlIL1cdXvd54DS5ae11tKEb GkuYCBx0t5IItd69dJ4pK5rmhLk9zkUdfQ+YrmpX96FoWpjhvvhvULgjQCGOjKFXo/0f 08lQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:in-reply-to:from :content-language:references:to:subject:cc:user-agent:mime-version :date:message-id:dkim-signature; bh=Eqyjgnp0qcFU9ZvgHCnxKY8f7179gjR+Yr8eDFcxftc=; b=Dn4lNF45legZaTmI5Jyi9p22Q7ONwo6wpuNeQ2JALgUa78kpOJYOvduwoZHDZPX1Dt 3XjnGoLWlx7dt0diCRFmryOmOn6NrYagLNXnK8SYjAhveg0LNKKymqpfOlfdl1GPlHGr +1CfqnEGUdR8j+1BfvGo4Y+RpBqbrtIsqfw1UXACdRXI0+er0XDTc1TB11XsBV/9bLaM NHRSKhJ+VbFvikT3Jd2YyZzqMzVOvVUuniGLxBn4GXIYJirjnUU9n6w+mIZcGX07znHD wPIlG1t6NLui3mMu8hg+yuq7fVyRcRbeKe9J5U4+AE3CPOgAskYBPBY6KuTC//a5Rge0 bEuw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@collabora.com header.s=mail header.b=kRefeMfE; 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=QUARANTINE sp=QUARANTINE dis=NONE) header.from=collabora.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id n17-20020a170903111100b001b55b830553si6474269plh.193.2023.06.22.03.16.54; Thu, 22 Jun 2023 03:17:06 -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=@collabora.com header.s=mail header.b=kRefeMfE; 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=QUARANTINE sp=QUARANTINE dis=NONE) header.from=collabora.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230242AbjFVKAM (ORCPT + 99 others); Thu, 22 Jun 2023 06:00:12 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:58526 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230125AbjFVKAG (ORCPT ); Thu, 22 Jun 2023 06:00:06 -0400 Received: from madras.collabora.co.uk (madras.collabora.co.uk [46.235.227.172]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 9D27B1A4; Thu, 22 Jun 2023 03:00:04 -0700 (PDT) Received: from [192.168.10.55] (unknown [182.179.162.32]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) (Authenticated sender: usama.anjum) by madras.collabora.co.uk (Postfix) with ESMTPSA id ACB56660700E; Thu, 22 Jun 2023 10:59:52 +0100 (BST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=collabora.com; s=mail; t=1687428003; bh=j6EIKy4cSoieiiC75xDAROKxOVZOc1C1Q3ERjaD2rrg=; h=Date:Cc:Subject:To:References:From:In-Reply-To:From; b=kRefeMfElCB0LrRwAPYztcZVCqNLKlAY97v3Q/+gSbt8FQGxVOiOkBAPJfhVBGx6v mmAZmocJdVTX/rjNz+1F8eGoJUORk1IdrLsGp3Z+dcEEKCCY/1POO+SLkGxgtPyYea iClcyMr22ugS09ZVw0JKZ6pJdESY0iN07Ru7l6Qh33JovoYECG8HFySgIz9RZ5dsJu m9TQvgRJTypc6GSUtvLPgvhCEmkeWHTN2YsuBmkHOGCG5voJ/WyscBGvjpKtQx2QQX 5Af7LXdLzf2Ldq09coY0AWmqPVxnnPRgYHszu5hdJrN502Q6JPV8YwM4auwxYskvqc pr/YXHD+luiDA== Message-ID: <76725a75-b17d-8a88-8d41-15c8daafe7e4@collabora.com> Date: Thu, 22 Jun 2023 14:59:48 +0500 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:102.0) Gecko/20100101 Thunderbird/102.12.0 Cc: Muhammad Usama Anjum , 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 Subject: Re: [PATCH v19 2/5] fs/proc/task_mmu: Implement IOCTL to get and optionally clear info about PTEs To: =?UTF-8?B?TWljaGHFgiBNaXJvc8WCYXc=?= References: <20230615141144.665148-1-usama.anjum@collabora.com> <20230615141144.665148-3-usama.anjum@collabora.com> <1c1beeda-ceed-fdab-bbf5-1881e0a8b102@collabora.com> Content-Language: en-US From: Muhammad Usama Anjum In-Reply-To: Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-2.2 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,NICE_REPLY_A,SPF_HELO_NONE, SPF_PASS,T_SCC_BODY_TEXT_LINE 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 6/21/23 6:29 PM, Michał Mirosław wrote: > On Wed, 21 Jun 2023 at 08:35, Muhammad Usama Anjum > wrote: >> On 6/20/23 11:03 PM, 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_pages, 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 = ULONG_MAX` would > avoid having to check !max_pages during the walk. I'll update. > > Best Regards > Michał Mirosław -- BR, Muhammad Usama Anjum