From mboxrd@z Thu Jan 1 00:00:00 1970 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 kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by smtp.lore.kernel.org (Postfix) with ESMTP id 9D806ECAAD3 for ; Sun, 4 Sep 2022 21:15:33 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 9E2868D004B; Sun, 4 Sep 2022 17:15:32 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 992FB8D0030; Sun, 4 Sep 2022 17:15:32 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 85A2F8D004B; Sun, 4 Sep 2022 17:15:32 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0016.hostedemail.com [216.40.44.16]) by kanga.kvack.org (Postfix) with ESMTP id 730488D0030 for ; Sun, 4 Sep 2022 17:15:32 -0400 (EDT) Received: from smtpin26.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay05.hostedemail.com (Postfix) with ESMTP id 52F0B41157 for ; Sun, 4 Sep 2022 21:15:32 +0000 (UTC) X-FDA: 79875659304.26.052DA69 Received: from casper.infradead.org (casper.infradead.org [90.155.50.34]) by imf30.hostedemail.com (Postfix) with ESMTP id F2C2280084 for ; Sun, 4 Sep 2022 21:15:30 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=casper.20170209; h=In-Reply-To:Content-Type:MIME-Version: References:Message-ID:Subject:Cc:To:From:Date:Sender:Reply-To: Content-Transfer-Encoding:Content-ID:Content-Description; bh=XsVMlt5hm6DrJhRld1OYvrTBNBmsOauY0XUQEvP4qQk=; b=U00f1HZ1fphnydaMdTK3Bvd2P+ y4veYWAISIY8EZF9zrLMhxxsm7mAe1XToDWjJW6R9TKnK+wbESAQvVYDkMjohZBrlYXP+MUe3aLfS VWWuNqtB+s+CZVKwBCkeqY6bwfxA4HF6CCBnuv6L/yFJK3H8V2j2rGEH3JxN05q+aWz+/lDcrh4gZ 6IOLVSmgNPT6rnZrnSKH4nxcr1nydiQL19uuE6vscIOj6TjV13Hy7aT9JVjfGNmLRv3EhTaBgiBPv 0OAPbpY2K377e//uCadaS4vFraHJyouODSRmnSKLl1XaAgsruX0OSclx5AnzVe29PsUpkL7u9AEtY rgHo763g==; Received: from willy by casper.infradead.org with local (Exim 4.94.2 #2 (Red Hat Linux)) id 1oUwxa-008we9-Ri; Sun, 04 Sep 2022 21:15:18 +0000 Date: Sun, 4 Sep 2022 22:15:18 +0100 From: Matthew Wilcox To: Cheng Li Cc: mike.kravetz@oracle.com, akpm@linux-foundation.org, linux-mm@kvack.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH] mm: use mem_map_offset instead of mem_map_next Message-ID: References: <1662300161-22049-1-git-send-email-lic121@chinatelecom.cn> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <1662300161-22049-1-git-send-email-lic121@chinatelecom.cn> ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1662326132; a=rsa-sha256; cv=none; b=7Zy4s1eCs8UInPurQHaCEaw1aOibYbnsmJ98+fkzDSilfJBDfgYV0yZhdh2EWg7bV3jfmq Z0ZlY6JR5vaSRVPdqtIY/7CgnjevmHzA0DB9Oxz2tXrS8FidaKxpT82DIByIoDfs7urptQ yd3ya2FcsaXCayD8g4T47cSf8AH6gYI= ARC-Authentication-Results: i=1; imf30.hostedemail.com; dkim=pass header.d=infradead.org header.s=casper.20170209 header.b=U00f1HZ1; spf=none (imf30.hostedemail.com: domain of willy@infradead.org has no SPF policy when checking 90.155.50.34) smtp.mailfrom=willy@infradead.org; dmarc=none ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1662326132; h=from:from:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-type:content-transfer-encoding: in-reply-to:in-reply-to:references:references:dkim-signature; bh=XsVMlt5hm6DrJhRld1OYvrTBNBmsOauY0XUQEvP4qQk=; b=WccMEp6nJJ30VaJId9SOk1MP6kGkT4ZsAnbfsIGmSq+E1TITdDXRtt6bY+2RZtv9r9lkzL V+Hu9ZGyXcMpDEWjItX/dTbhutf/2pNV++5ndK9HVHHa7F6vKQbtHX+I8odoUkyy5xX1II Hd/YTEAGjwDsLLqljDeH72nBzEe3vPQ= Authentication-Results: imf30.hostedemail.com; dkim=pass header.d=infradead.org header.s=casper.20170209 header.b=U00f1HZ1; spf=none (imf30.hostedemail.com: domain of willy@infradead.org has no SPF policy when checking 90.155.50.34) smtp.mailfrom=willy@infradead.org; dmarc=none X-Rspam-User: X-Rspamd-Server: rspam12 X-Stat-Signature: 5kudyoonhhhbx4fxdyo9pxeeqbbf6c7w X-Rspamd-Queue-Id: F2C2280084 X-HE-Tag: 1662326130-652913 X-Bogosity: Ham, tests=bogofilter, spamicity=0.000000, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: On Sun, Sep 04, 2022 at 02:02:41PM +0000, Cheng Li wrote: > To handle discontiguity case, mem_map_next() has a parameter named > `offset`. As a function caller, one would be confused why "get > next entry" needs a parameter named "offset". The other drawback of > mem_map_next() is that the callers must take care of the map between > parameter "iter" and "offset", otherwise we may get an hole or > duplication during iteration. So we use mem_map_offset instead of > mem_map_next. I think we should go further and get rid of mem_map_offset(). nth_page() is now more efficient than mem_map_offset().