Received: by 2002:a05:6a10:9848:0:0:0:0 with SMTP id x8csp4531437pxf; Tue, 30 Mar 2021 09:59:00 -0700 (PDT) X-Google-Smtp-Source: ABdhPJz+afzu4a0e4iq5vSQPLdsR7XbhAfH0uLL8cs7JvZtWxZymMlaWuKurXuxdPw9pVekofAgB X-Received: by 2002:a17:907:3e8c:: with SMTP id hs12mr34531349ejc.105.1617123540006; Tue, 30 Mar 2021 09:59:00 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1617123539; cv=none; d=google.com; s=arc-20160816; b=UIjis2/adCWVdK1zo3KlrowI7DT4NE/6njH7nwp/0uN5YEAaOl8Yvq2veI7+H/fYHN og2+7rS5ofuUtMLT05sxhGPl4vYBP0m+SsYcyygkvgw4OPqGBYMW0+h5gDOZwL1Lib7Z S5wNjxXIMDCYXdHn/0pFxcxzFj9pCDo+aJvPQOI2BGC63q9HW6PYn0ylhmx/2wUAvLw4 5ASXvV9TZI1IBsftGx5bqzd6zPmcRLjBikV13abVdhT3Mmw2mOK0ApBEzyci2eGV98Ld Z7MJIDuZO3zz1RSdoV3fCZpi3wd8Ox3t6vOu2JFebguAYWRPItkAxvqZgaaym3h69gKw GV+w== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:user-agent:in-reply-to:content-disposition :mime-version:references:message-id:subject:cc:to:from:date; bh=qeaOx6weF2HNd0QNqQeM5kZapXQB41RVvgThZM0FDE8=; b=wboX2VvtpW5XLDFhy218T99eid7ZGWj84I6G+QYcrK80qYsdq3Bxut/TmIf2r9N1/+ 8yU0uNnUtWs90x40TqO6Ckaj7gjEVBPKk8LDmfg2tHlGVQkCAXTwSDCOh79eDwHb6BVb LfT5QOQtANsGfu6NkwCttnHv7l1MOWFScSEhPXJvvuZdfL+on6hq78EtKWNf1OV6xwqB y5zw0V8WFWpwJl+pZ+k+wOU6HeFjViEstMsru2Ib+gp1ztp+EX+bEBaEPaJCnoPgW859 SJw7cGGeLHH4cHPWWvJMNmGDR+pKo8666tpUu4TnsmUo84uu9UIKcFuDjhjU6fAN3wip vWrA== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id hd31si14463053ejc.257.2021.03.30.09.58.37; Tue, 30 Mar 2021 09:58:59 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232349AbhC3Q5k (ORCPT + 99 others); Tue, 30 Mar 2021 12:57:40 -0400 Received: from verein.lst.de ([213.95.11.211]:59774 "EHLO verein.lst.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232048AbhC3Q50 (ORCPT ); Tue, 30 Mar 2021 12:57:26 -0400 Received: by verein.lst.de (Postfix, from userid 2407) id F061768B02; Tue, 30 Mar 2021 18:57:23 +0200 (CEST) Date: Tue, 30 Mar 2021 18:57:23 +0200 From: Christoph Hellwig To: Ming Lei Cc: Jens Axboe , linux-block@vger.kernel.org, Christoph Hellwig , linux-kernel@vger.kernel.org Subject: Re: [PATCH 2/2] blktrace: limit allowed total trace buffer size Message-ID: <20210330165723.GB13829@lst.de> References: <20210323081440.81343-1-ming.lei@redhat.com> <20210323081440.81343-3-ming.lei@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20210323081440.81343-3-ming.lei@redhat.com> User-Agent: Mutt/1.5.17 (2007-11-01) Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Tue, Mar 23, 2021 at 04:14:40PM +0800, Ming Lei wrote: > On some ARCHs, such as aarch64, page size may be 64K, meantime there may Which we call arm64.. > be lots of CPU cores. relay_open() needs to allocate pages on each CPU > blktrace, so easily too many pages are taken by blktrace. For example, > on one ARM64 server: 224 CPU cores, 16G RAM, blktrace finally got > allocated 7GB in case of 'blktrace -b 8192' which is used by device-mapper > test suite[1]. This way could cause OOM easily. > > Fix the issue by limiting max allowed pages to be 1/8 of totalram_pages(). Doesn't this break the blktrace ABI by using different buffer size and numbers than the user asked for? I think we can enforce an upper limit and error out, but silently adjusting seems wrong. Wouldn't it make more sense to fix userspace to not request so many and so big buffers instead?