Received: by 2002:a05:7412:bbc7:b0:fc:a2b0:25d7 with SMTP id kh7csp2975779rdb; Tue, 6 Feb 2024 03:39:17 -0800 (PST) X-Google-Smtp-Source: AGHT+IEYMV/sn3loqLaHUoNOjj6Y0kvIrM5hQCxVn1bzrEAL77FkJH2xKdRJ6HskZjR5IcQr/Bd5 X-Received: by 2002:a05:6871:298:b0:219:217a:11d2 with SMTP id i24-20020a056871029800b00219217a11d2mr2816091oae.0.1707219557336; Tue, 06 Feb 2024 03:39:17 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1707219557; cv=pass; d=google.com; s=arc-20160816; b=J7ARYQ81+muYQw5h+NwkR/8M/zwn+GcKuC4eMA56OR/L9M9P4k7JFaaX50LedHgURr 28levBmmcPfWymAqQLsLpf5KJOw4tVdHeDx5XcRhVS3TOAh4si91av7YzDelKP6KwMRM Eb08SmHRDHbkMjQqbY3i99wEIpZKmWRWUBItzJ3+B7906Fd5PduJN1Rt+p+8lKni3PxE 77xw3rDN5ZmauwHNLjLPR7n48DOwE8IfeeT4EYQrmy47a2wQVbUh5kuzEJcqNUDM55iH Z9EMLTcztnFIk3jB09azZKlQQLZnZ1bcNbM/D6H41uEC9NH+EPacAqSciS/cUGEUsoZX wXdg== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:in-reply-to:from:references:cc:to :content-language:subject:user-agent:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:date:message-id; bh=Qvng+wUUd4munMOPMeJKr7FDLMK3w1fkevuqxeojIuI=; fh=f5DFswMet1bcQBjel0c6Ht05/mSeDwn1m8bAZFm1ITs=; b=uU8X3JXA7OJHHi8QW/elgopO7jzYMdSOGN3CZ7mtgfWkBC2YTlp9kBY39Gur2jiivZ fnCfL0eWPwKeZ/LcyWkXVqAgsglx5v+GFl7Ud6ST6zszbkO9Z3HB0PNJHeHs3g/uVVbJ eJKX+U4vg0VhtF8yQ4czbOnSEUI47DNUSgfXu4q2YxQG4qwWLPEcGSXtGgd0zj7H6KzR sWekZrQgWoIi1V6qBBW3VHq+OMVEGh/ZC1QfLqehNOa2G9OF8e58Xk5Ki92dSVlpIU1P i0ap0hX5IBE3UyDOHj3JGYtfG5livyYg3NZPzgOhFrloCisL5CQ04/FuPAUSq+HngmWh tawQ==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; arc=pass (i=1 spf=pass spfdomain=arm.com dmarc=pass fromdomain=arm.com); spf=pass (google.com: domain of linux-kernel+bounces-54781-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.48.161 as permitted sender) smtp.mailfrom="linux-kernel+bounces-54781-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=arm.com X-Forwarded-Encrypted: i=1; AJvYcCU5HKdoFQH+HbTox23kgxYZbej8vgLFfee/JTeti7zommxkzp8PAjzUabljENmCTPTvmRSk43JmYa+rPfWnGLoDuZ39GLJF2oKsBjr+TA== Return-Path: Received: from sy.mirrors.kernel.org (sy.mirrors.kernel.org. [147.75.48.161]) by mx.google.com with ESMTPS id j27-20020a63fc1b000000b005dbec1a87b2si1539282pgi.247.2024.02.06.03.39.16 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 06 Feb 2024 03:39:17 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-54781-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.48.161 as permitted sender) client-ip=147.75.48.161; Authentication-Results: mx.google.com; arc=pass (i=1 spf=pass spfdomain=arm.com dmarc=pass fromdomain=arm.com); spf=pass (google.com: domain of linux-kernel+bounces-54781-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.48.161 as permitted sender) smtp.mailfrom="linux-kernel+bounces-54781-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=arm.com Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by sy.mirrors.kernel.org (Postfix) with ESMTPS id 4CCF7B22DC8 for ; Tue, 6 Feb 2024 11:38:28 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 6CF3F12F399; Tue, 6 Feb 2024 11:32:23 +0000 (UTC) Received: from foss.arm.com (foss.arm.com [217.140.110.172]) by smtp.subspace.kernel.org (Postfix) with ESMTP id B5F76132489 for ; Tue, 6 Feb 2024 11:32:20 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=217.140.110.172 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1707219142; cv=none; b=NYNCwH81uXQ31ykEyxKpv8tSHWPhXHw28uWArCYigpnBQyaX5bvfQk0qUsd/b/So8w6Np8/H8GQqoLJW+ZA2GoOqNbpOBVx5ld7PcNa5I1uG3s0nDljOlTyhZdGDXWhnLpSGPJ6O/eFw+RCDlLM/q2iR2niQnggAQ+xCb2xEnDc= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1707219142; c=relaxed/simple; bh=/IMGTCxErD0wgwGqZAwjLejE+uSkhLispC8aFwiGNqg=; h=Message-ID:Date:MIME-Version:Subject:To:Cc:References:From: In-Reply-To:Content-Type; b=lDFrr33XEo86xGsyCP4FjzaP5WJ4XFbD/KfYNpn0hjGv8amPAGPMOdoPsDipwhIsVmE1xDMk7EXtv0RiIDa1Ykh/PHDdxEISFJ5fCqTe9zGZhbMW3yDlpRThZTHWMuovBFLcKRdDO1dI+s4A0nWidNJBSWpDFaqb2PVlQXuxVek= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=arm.com; spf=pass smtp.mailfrom=arm.com; arc=none smtp.client-ip=217.140.110.172 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=arm.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=arm.com Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.121.207.14]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id C2CE51FB; Tue, 6 Feb 2024 03:33:02 -0800 (PST) Received: from [10.1.196.40] (e121345-lin.cambridge.arm.com [10.1.196.40]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id 306B03F762; Tue, 6 Feb 2024 03:32:19 -0800 (PST) Message-ID: <0d1f81a8-999e-459d-9e5c-7efff665646e@arm.com> Date: Tue, 6 Feb 2024 11:32:17 +0000 Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: Re: [PATCH v3 3/3] iommu/iova: use named kmem_cache for iova magazines Content-Language: en-GB To: John Garry , joro@8bytes.org Cc: will@kernel.org, pasha.tatashin@soleen.com, iommu@lists.linux.dev, linux-kernel@vger.kernel.org, linux-mm@kvack.org, rientjes@google.com, yosryahmed@google.com References: <83a0aafc-8a9c-48ce-a203-96b901489d41@oracle.com> From: Robin Murphy In-Reply-To: <83a0aafc-8a9c-48ce-a203-96b901489d41@oracle.com> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 8bit On 06/02/2024 11:24 am, John Garry wrote: > On 05/02/2024 15:32, Robin Murphy wrote: >> From: Pasha Tatashin >> >> The magazine buffers can take gigabytes of kmem memory, dominating all >> other allocations. For observability purpose create named slab cache so >> the iova magazine memory overhead can be clearly observed. >> >> With this change: >> >>> slabtop -o | head >>   Active / Total Objects (% used)    : 869731 / 952904 (91.3%) >>   Active / Total Slabs (% used)      : 103411 / 103974 (99.5%) >>   Active / Total Caches (% used)     : 135 / 211 (64.0%) >>   Active / Total Size (% used)       : 395389.68K / 411430.20K (96.1%) >>   Minimum / Average / Maximum Object : 0.02K / 0.43K / 8.00K >> >> OBJS ACTIVE  USE OBJ SIZE  SLABS OBJ/SLAB CACHE SIZE NAME >> 244412 244239 99%    1.00K  61103       4    244412K iommu_iova_magazine >>   91636  88343 96%    0.03K    739     124      2956K kmalloc-32 >>   75744  74844 98%    0.12K   2367      32      9468K kernfs_node_cache >> >> On this machine it is now clear that magazine use 242M of kmem memory. > > Those caches could do with a trimming ... See the discussion on v1 for more details: https://lore.kernel.org/linux-iommu/20240201193014.2785570-1-tatashin@google.com/ but it seems this really is the idle baseline for lots of CPUs * lots of domains - if all those devices get going in anger it's likely that combined iova + iova_magazine usage truly will blow up into gigabytes. Cheers, Robin. > >> >> Acked-by: David Rientjes >> Signed-off-by: Pasha Tatashin >> [ rm: adjust to rework of iova_cache_{get,put} ] >> Signed-off-by: Robin Murphy >> --- > > FWIW: > Reviewed-by: John Garry