From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mgamail.intel.com (mgamail.intel.com [192.198.163.9]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 417372192F9 for ; Tue, 25 Nov 2025 18:30:31 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=192.198.163.9 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1764095434; cv=none; b=HWhvW41lwyPoBb7az0fZOoD30xuyrlKRcffjkteeO3ofUi5eXdinWUkrx5LOjMtiLyG5oZkZc/mCc/hJGaVj+f/wP5IqAPUC1LsyMIRYogV5JWmW82gDjnkKuDqHeb16Zgf/JRfVTXhkF1fNkSVs5ionYElCVBsZkn3yFmv9vok= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1764095434; c=relaxed/simple; bh=NUvziSnwUsI+BlkSFwglbw1GmZ09Ymmocff6QMzrKcg=; h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version: Content-Type:Content-Disposition:In-Reply-To; b=Uglr0ne304m2+4n/jtSx8fPNKvWSLLocseXBfgLHz5nId6zpaTmNoxTAq2T9uZ5WMlEEpDYEqdF8NFDjktegLtt29UMTEmbSG6jb1aTQgkwVKHoWYG5mhABIiqVq8kN3XMiTKb2CYZSHZlKE1jm99goIC+/D956hnCodcq2neDs= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.intel.com; spf=pass smtp.mailfrom=linux.intel.com; dkim=pass (2048-bit key) header.d=intel.com header.i=@intel.com header.b=Ev5R9ku/; arc=none smtp.client-ip=192.198.163.9 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.intel.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=linux.intel.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=intel.com header.i=@intel.com header.b="Ev5R9ku/" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1764095432; x=1795631432; h=date:from:to:cc:subject:message-id:references: mime-version:content-transfer-encoding:in-reply-to; bh=NUvziSnwUsI+BlkSFwglbw1GmZ09Ymmocff6QMzrKcg=; b=Ev5R9ku/Lh4Ft3C/kVXTc3UbPSaBinADuNmNi2DF4PLCBqFTvVEKJe0r oFS+DP6pBY7xlp2W90xm7FkiZkJvd3B4vtO22enifcIvEbBc6KXB9lXka nPOz7E8CWiMMU9SixqbNokznUDnCK7XoMwy/VqGibzA6l4la+zC2tri0r Ue8BeX2X2vo4TzIJqNWXYuw+LM3VV1uAJ3zlY+TCCivVm9WiOcT+mqJjl C92QLJ00ieulLq7EOYkd6lLyr6TpyueolHVzUMYYfL74q8lbIsupnJhjH rVgHYPRrfoA5Vnzj4B2TpYubjCBinWKTb9GnTLb2KRuMESRaw74PLdZS6 A==; X-CSE-ConnectionGUID: pRtEay2/TCOKeH3uKrkgyA== X-CSE-MsgGUID: Bvh/ibMiROiZ8gx1UOxc7w== X-IronPort-AV: E=McAfee;i="6800,10657,11624"; a="76807630" X-IronPort-AV: E=Sophos;i="6.20,226,1758610800"; d="scan'208";a="76807630" Received: from orviesa005.jf.intel.com ([10.64.159.145]) by fmvoesa103.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 25 Nov 2025 10:30:31 -0800 X-CSE-ConnectionGUID: tN75m1bSRkS2URnnqoiRiw== X-CSE-MsgGUID: unu7x+RiQCuE8AgZ4GThDA== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="6.20,226,1758610800"; d="scan'208";a="197818542" Received: from ncintean-mobl1.ger.corp.intel.com (HELO localhost) ([10.245.245.22]) by orviesa005-auth.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 25 Nov 2025 10:30:29 -0800 Date: Tue, 25 Nov 2025 20:30:26 +0200 From: "andriy.shevchenko@linux.intel.com" To: "Stamatis, Ilias" Cc: "nadav.amit@gmail.com" , "david@kernel.org" , "linux-mm@kvack.org" , "akpm@linux-foundation.org" , "linux-kernel@vger.kernel.org" , "huang.ying.caritas@gmail.com" , "bhe@redhat.com" , "nh-open-source@amazon.com" Subject: Re: [PATCH] Reinstate "resource: avoid unnecessary lookups in find_next_iomem_res()" Message-ID: References: <20251124085816.07dbf5a4ec6235b2943840a0@linux-foundation.org> <265028eb24f60ce45725d7887e93f76a3e86f897.camel@amazon.co.uk> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: <265028eb24f60ce45725d7887e93f76a3e86f897.camel@amazon.co.uk> Organization: Intel Finland Oy - BIC 0357606-4 - c/o Alberga Business Park, 6 krs, Bertel Jungin Aukio 5, 02600 Espoo On Tue, Nov 25, 2025 at 02:23:38PM +0000, Stamatis, Ilias wrote: > On Tue, 2025-11-25 at 12:23 +0200, andriy.shevchenko@linux.intel.com wrote: > > Thanks for elaboration. > > > > Please summarise this, add the performance test results and send a v2. > > Seems okay to me. > > How does this look? > > No code change, but happy to send a v2 if that makes things easier for merging. Yes, please do. > Reinstate "resource: avoid unnecessary lookups in find_next_iomem_res()" resource: Reinstate "avoid unnecessary lookups in find_next_iomem_res()" (always keep leading prefix). > Commit 97523a4edb7b ("kernel/resource: remove first_lvl / siblings_only > logic") removed an optimization introduced by commit 756398750e11 > ("resource: avoid unnecessary lookups in find_next_iomem_res()"). That > was not called out in the message of the first commit explicitly so it's > not entirely clear whether removing the optimization happened > inadvertently or not. > > As the original commit message of the optimization explains there is no > point considering the children of a subtree in find_next_iomem_res() if > the top level range does not match. > > Reinstating the optimization results in performance improvements in > systems where /proc/iomem is ~5k lines long. Calling mmap() on /dev/mem > in such platforms takes 700-1500μs without the optimisation and 10-50μs > with the optimisation. > > Note that even though commit 97523a4edb7b removed the 'sibling_only' > parameter from next_resource(), newer kernels have basically reinstated > it under the name 'skip_children'. > > Link: https://lore.kernel.org/all/20251124165349.3377826-1-ilstam@amazon.com/T/#u > Fixes: 97523a4edb7b ("kernel/resource: remove first_lvl / siblings_only logic") > Signed-off-by: Ilias Stamatis > Acked-by: David Hildenbrand (Red Hat) The rest LGTM. Also, if required, make a comment in the code aligned with this new commit message. -- With Best Regards, Andy Shevchenko