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 DE367C05027 for ; Thu, 26 Jan 2023 14:33:17 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232234AbjAZOdQ (ORCPT ); Thu, 26 Jan 2023 09:33:16 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:42172 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232228AbjAZOdL (ORCPT ); Thu, 26 Jan 2023 09:33:11 -0500 Received: from madras.collabora.co.uk (madras.collabora.co.uk [IPv6:2a00:1098:0:82:1000:25:2eeb:e5ab]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id D358A47437; Thu, 26 Jan 2023 06:33:06 -0800 (PST) Received: from [192.168.10.12] (unknown [39.45.165.226]) (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 A80EE6602E70; Thu, 26 Jan 2023 14:32:58 +0000 (GMT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=collabora.com; s=mail; t=1674743585; bh=mV9P8bJmZu6ZoVaX/AoLhr6Mb+mbynE4WbhCFBSCjyE=; h=Date:Cc:Subject:To:References:From:In-Reply-To:From; b=FNbePeBQeO8Fdj/wt46vQOVYphnTBs4KEpYulFjh8hvNua+sMT7opUr8ibsC+Eh93 0OQeEXt+yEX3c+Z0t8r2Q9gNHLjgXearU+jHnYfS3oRNcYb+N+/Em2U8UtgyPclSLE vlk/ZrkmCi95r9EKBWKa3Xrw4J4Vj6ODkBva2Q5Ea+X7BNJKCyvUflEpMFUWEz203F wMJuADIlJs3vX2xWykkCRgcMGahtzEAeLo/1AzxnsOogEh325x7/m4ITpd6I1Enq3j QKm4ZnmMS6hH+0lSbMnk6o1qbx7GKkAKA+wqtZTXMA97N1HPH0yAiLNKZO8RyjmLD6 NiKy62m6D6/6g== Message-ID: Date: Thu, 26 Jan 2023 19:32:53 +0500 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:102.0) Gecko/20100101 Thunderbird/102.6.0 Cc: Muhammad Usama Anjum , David Hildenbrand , Andrew Morton , =?UTF-8?B?TWljaGHFgiBNaXJvc8WC?= =?UTF-8?Q?aw?= , 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 Subject: Re: [PATCH v7 3/4] fs/proc/task_mmu: Implement IOCTL to get and/or the clear info about PTEs To: Peter Xu References: <20230109064519.3555250-1-usama.anjum@collabora.com> <20230109064519.3555250-4-usama.anjum@collabora.com> <31b71791-66b0-c2d8-81da-e17eff5ffbe8@collabora.com> Content-Language: en-US From: Muhammad Usama Anjum In-Reply-To: Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 1/24/23 10:30 PM, Peter Xu wrote: > On Mon, Jan 23, 2023 at 05:18:13PM +0500, Muhammad Usama Anjum wrote: >>>> + if (IS_GET_OP(p) && p->max_pages && (p->found_pages == p->max_pages)) >>>> + return -ENOSPC; >>> >>> This is the function to test "whether the walker should walk the vma >>> specified". This check should IIUC be meaningless because found_pages >>> doesn't boost during vma switching, while OTOH your pmd walker fn should do >>> proper check when increasing found_pages and return -ENOSPC properly when >>> the same condition met. That should be enough, IMHO. >> This check is needed in case we want to abort the walk at once. We return >> negative value from here which aborts the walk. Returning negative value >> from pmd_entry doesn't abort the walk. So this check is needed in the >> test_walk. > > Why? What I see locally is (walk_pmd_range): > > if (ops->pmd_entry) > err = ops->pmd_entry(pmd, addr, next, walk); > if (err) > break; Sorry, mistake on my part. I'll correct it in next version (v9). > > Thanks, > -- BR, Muhammad Usama Anjum