Received: by 2002:a05:6358:d09b:b0:dc:cd0c:909e with SMTP id jc27csp3958908rwb; Tue, 8 Nov 2022 10:14:31 -0800 (PST) X-Google-Smtp-Source: AA0mqf5hCu8SSmhLfV3UTeSDyoq7h2da0AlteIHcs/lk8HsorcJcgQ73IQ9OluY5DM2U6JHnHGKD X-Received: by 2002:a17:902:ce88:b0:188:6429:fedd with SMTP id f8-20020a170902ce8800b001886429feddmr24695424plg.0.1667931271519; Tue, 08 Nov 2022 10:14:31 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1667931271; cv=none; d=google.com; s=arc-20160816; b=S50UWPl7ltf5ZKCoHn/sBvqgy+OyXwdA0pBcODGO0nCEAFceFElztYWgv4/LBBdLGW /U/2/GHsgjCi1aS3SUz7XseWMjzSDsp/eKqiqpG5jIkIUSZUhigbCD1ibaIzuX+XwGAT 7LKfiqDdVgZFcLF5dlHkEOIuOSjBG6Jix7eoWCj22AxFCjy8Lhk1lnZxIKg8y7yV1hy6 e5fuw+fzCPqBRty0qYeP+8+B+PEYL/n3qzLRT+/PbvSqXjD5cdgW6RkhGUknzn9hxVeW 2bz/R4vVssOc8zCWK/gi6UydbSY0WmOFyjwSjp48E6kysd+NSu56O/31sC7H20PRuRzW Dg7A== 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=AqWq6TzMurzh6UbNAe6JjspSN554CwdG+TYI594CkYQ=; b=mTImtCNvnxhEIi5h5TZ1KAHTrWuyX7DOARu3fdzCaR2NxZNwi+qKyhc0FhqCl55Dpf Vmm6DqkAnElTVxpRgQkJmpY5ZX8Grr36ne2IgBqStdAnNYtEWXDJs4RiUkcb6RJalXeV ze/YO9Llvd2NUbCqp0qyssGriXx4gPk+iYmwxjc045BFAuv3i6FgJ5zyii9Vw6TOq7dl zHp4ENFMJ8gYhC/tkNzj73m+6TIvosphJNEy/TY2e1g9uIWA9w6UfOxxZ7YKpFwRZR/p YEqcEn8Cm88rBW0svDp5pr0msB08oQwWmgZ5V73dWqg3hk+A+XgEJrkMcJyAiibrZC2d ozfw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@collabora.com header.s=mail header.b=FhaJOARj; 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=NONE sp=NONE 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 h18-20020a170902f71200b00176e05275d1si15035419plo.423.2022.11.08.10.14.18; Tue, 08 Nov 2022 10:14:31 -0800 (PST) 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=FhaJOARj; 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=NONE sp=NONE dis=NONE) header.from=collabora.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234705AbiKHRvR (ORCPT + 91 others); Tue, 8 Nov 2022 12:51:17 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:49202 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234682AbiKHRvQ (ORCPT ); Tue, 8 Nov 2022 12:51:16 -0500 Received: from madras.collabora.co.uk (madras.collabora.co.uk [46.235.227.172]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 70890C26; Tue, 8 Nov 2022 09:51:15 -0800 (PST) Received: from [192.168.10.9] (unknown [39.45.244.84]) (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 CBD496602040; Tue, 8 Nov 2022 17:51:08 +0000 (GMT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=collabora.com; s=mail; t=1667929874; bh=NRAtcPw2wnMbEi41WFnnZ8Awkgbk4HFCvEFBYvlaf/4=; h=Date:Cc:Subject:To:References:From:In-Reply-To:From; b=FhaJOARjyis7Xbl1jdgCk+Obgpxov4IyFBEYPkzWBkU82YMHGk4/kXhJcEtw2DRyJ Yu6Ovbx888FeahhlQCbYTE5KscYnW4ibFwSjUx7HqOQZNXhyEymr97VTCLmZPOwtMP HMkfN9FC92BymBg7Jhxwupq2MmVFNVVk4aFS2/w38jkjJKkYKHQQqRLI0Azqu7f8i7 baKNZlNjfZZQ1885uL+FThUD3LTmtuytVQJ5bdFT9qqkaAerAvfdOmKMGbKdf39spZ EygwwnPpIcLfTLHXTZplnDA8Bipf8ydKP3JY1l6nqSkEzT/myLYo8Y1RFV0QeTy7YP AXrbmTXyVqzqQ== Message-ID: Date: Tue, 8 Nov 2022 22:51:04 +0500 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:102.0) Gecko/20100101 Thunderbird/102.4.0 Cc: Muhammad Usama Anjum , Andrei Vagin , Danylo Mocherniuk , Alexander Viro , Andrew Morton , Suren Baghdasaryan , Greg KH , Christian Brauner , Peter Xu , Yang Shi , Vlastimil Babka , Zach O'Keefe , "Matthew Wilcox (Oracle)" , "Gustavo A. R. Silva" , Dan Williams , kernel@collabora.com, Gabriel Krisman Bertazi , David Hildenbrand , Peter Enderborg , "open list : KERNEL SELFTEST FRAMEWORK" , Shuah Khan , open list , "open list : PROC FILESYSTEM" , "open list : MEMORY MANAGEMENT" Subject: Re: [PATCH v5 2/3] fs/proc/task_mmu: Implement IOCTL to get and/or the clear info about PTEs To: =?UTF-8?B?TWljaGHFgiBNaXJvc8WCYXc=?= References: <20221103145353.3049303-1-usama.anjum@collabora.com> <20221103145353.3049303-3-usama.anjum@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.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,NICE_REPLY_A,SPF_HELO_NONE, SPF_PASS 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 11/8/22 9:00 PM, Michał Mirosław wrote: >>>> + * @start: Starting address of the region >>>> + * @len: Length of the region (All the pages in this length are included) >>>> + * @vec: Address of page_region struct array for output >>>> + * @vec_len: Length of the page_region struct array >>>> + * @max_pages: Optional max return pages (It must be less than vec_len if specified) >>> I think we discussed that this is not counting the same things as >>> vec_len, so there should not be a reference between the two. The limit >>> is whatever fits under both conditions (IOW: n_vecs <= vec_len && >>> (!max_pages || n_pages <= max_pages). >> In worse case when pages cannot be folded into the page_region, the one >> page_region may have information of only one page. This is why I've >> compared them. I want to communicate to the user that if max_pages is >> used, the vec_len should be of equal or greater size (to cater worse >> case which can happen at any time). Otherwise in worse case, the api can >> return without finding the max_pages number of pages. I don't know how >> should I put this in the comment. > I'm not sure you need to, as this conclusion follows from the range vs > page distinction. > A user who wants to cater for the worst case will provide big-enough > `vec` array, but another, who might be memory-constrained, could > instead just retry the call with `start` updated to just after the > last returned page until the ioctl() returns less ranges than > `vec_len` allows. Makes sense. I'll update and send next revision. Thanks, Usama > > Best Regards > Michał Mirosław