Received: by 2002:a05:6a10:9848:0:0:0:0 with SMTP id x8csp1439021pxf; Fri, 2 Apr 2021 10:28:08 -0700 (PDT) X-Google-Smtp-Source: ABdhPJw13wzC8DadF6abCJ3A7NKDGe9+puVGcgi+ksYGey2F4yCGJLudHEMR08IHI8pIwlmiSjjC X-Received: by 2002:a5e:840a:: with SMTP id h10mr11914768ioj.206.1617384488301; Fri, 02 Apr 2021 10:28:08 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1617384488; cv=none; d=google.com; s=arc-20160816; b=S5p6yrWZObPjC0wXeNruKDEIXeZrRwFggVmr8gmoGu7wjFuDRM7vlamRdjo5QAyCo2 oh7OcuByO5vCGYVcPpVFNJShMeH6ojgI53h7c6EgjnKW7sslDKpcAi0WJZmo2wa77uj7 zjWC50GO67palSChx1nsgf6/M6eyIm30rWYUIyFtPayZXnPj5M/gIRCsCSa4Bxyb2JKw J4gFYyO8n4uKV6dyfjbs2qAg0IcuV1ZyAOTN8wlh8VIah+MUkSqMg2keCrHLLJ4O7t7F /x/xH/mZHWm1RXdNXHohkxQsnmBslE/mPIj/G/cyOLJmBZr1rMko+SsHVRjrsksDsFJ2 zHKg== 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=wCzeQP86PSBX4RlhhI+A+kJRlDxXNkIREB+kFjdgDig=; b=B01SDT8IYyKEne5W72EPfSI1KIVetU9daQazPjCwFbf1jgRBnk9zd8ubDqadQa/dIn CMckEHw0+FuTi6o97rLxFESATOAjXeCGXnMfoniwoDB3Vo1q+hpYvbYHL2AbWVVpXLGq RIYTcfgM8jZNwMkRMAPduEjOtcm89V5NiZXEmauNqgibmJrlnnEMb7IWyrFF2J9c7Ldz tsFbColcOCl/P7DBNUDTI40uORVkY9GBQ6RxT94qXLdXh+Uvzwz4rCeb27dIEJepndZi I5zJPCL1f/dSPFG4brnjcqM+xRgW3/bgBejfHNaVL9P1qz1ZQ4nGg5LM4v23nj9+XZRZ nkZw== 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 d4si1190972ilf.160.2021.04.02.10.27.53; Fri, 02 Apr 2021 10:28:08 -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 S234526AbhDBR1e (ORCPT + 99 others); Fri, 2 Apr 2021 13:27:34 -0400 Received: from verein.lst.de ([213.95.11.211]:44445 "EHLO verein.lst.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229553AbhDBR1d (ORCPT ); Fri, 2 Apr 2021 13:27:33 -0400 Received: by verein.lst.de (Postfix, from userid 2407) id 71A1368BFE; Fri, 2 Apr 2021 19:27:30 +0200 (CEST) Date: Fri, 2 Apr 2021 19:27:30 +0200 From: Christoph Hellwig To: Ming Lei Cc: Christoph Hellwig , Jens Axboe , linux-block@vger.kernel.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH 1/2] block: shutdown blktrace in case of fatal signal pending Message-ID: <20210402172730.GA22923@lst.de> References: <20210323081440.81343-1-ming.lei@redhat.com> <20210323081440.81343-2-ming.lei@redhat.com> <20210330165330.GA13829@lst.de> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.5.17 (2007-11-01) Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Wed, Mar 31, 2021 at 08:16:50AM +0800, Ming Lei wrote: > On Tue, Mar 30, 2021 at 06:53:30PM +0200, Christoph Hellwig wrote: > > On Tue, Mar 23, 2021 at 04:14:39PM +0800, Ming Lei wrote: > > > blktrace may allocate lots of memory, if the process is terminated > > > by user or OOM, we need to provide one chance to remove the trace > > > buffer, otherwise memory leak may be caused. > > > > > > Fix the issue by shutdown blktrace in case of task exiting in > > > blkdev_close(). > > > > > > Signed-off-by: Ming Lei > > > > This just seems weird. blktrace has no relationship to open > > block device instances. > > blktrace still needs to open one blkdev, then send its own ioctl > commands to block layer. In case of OOM, the allocated memory in > these ioctl commands won't be released. > > Or any other suggestion? Not much we can do there I think. If we want to autorelease memory it needs to be an API that ties the memory allocation to an FD.