From mboxrd@z Thu Jan 1 00:00:00 1970 From: "Jun'ichi Nomura" Subject: Re: [dm-devel] [PATCH v2 02/14] dm: kill dm_rq_bio_destructor Date: Thu, 24 May 2012 10:16:09 +0900 Message-ID: <4FBD8BD9.8070708@ce.jp.nec.com> References: <1337817771-25038-1-git-send-email-koverstreet@google.com> <1337817771-25038-3-git-send-email-koverstreet@google.com> <4FBD7E80.4020005@ce.jp.nec.com> <20120524003915.GA27443@google.com> Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit Return-path: In-Reply-To: <20120524003915.GA27443-hpIqsD4AKlfQT0dZR+AlfA@public.gmane.org> Sender: linux-bcache-owner-u79uwXL29TY76Z2rM5mHXA@public.gmane.org To: Kent Overstreet Cc: device-mapper development , linux-kernel-u79uwXL29TY76Z2rM5mHXA@public.gmane.org, linux-bcache-u79uwXL29TY76Z2rM5mHXA@public.gmane.org, linux-fsdevel-u79uwXL29TY76Z2rM5mHXA@public.gmane.org, axboe-tSWWG44O7X1aa/9Udqfwiw@public.gmane.org, yehuda-L5o5AL9CYN0tUFlbccrkMA@public.gmane.org, mpatocka-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org, vgoyal-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org, bharrosh-C4P08NqkoRlBDgjK7y7TUQ@public.gmane.org, tj-DgEjT+Ai2ygdnm+yROfE0A@public.gmane.org, sage-BnTBU8nroG7k1uMJSBkQmQ@public.gmane.org, agk-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org, drbd-dev-cunTk1MwBs8qoQakbn7OcQ@public.gmane.org List-Id: dm-devel.ids On 05/24/12 09:39, Kent Overstreet wrote: > On Thu, May 24, 2012 at 09:19:12AM +0900, Jun'ichi Nomura wrote: >> The destructor may also be called from blk_rq_unprep_clone(), >> which just puts bio. >> So this patch will introduce a memory leak. > > Well, keeping around bi_destructor solely for that reason would be > pretty lousy. Can you come up with a better solution? I don't have good one but here are some ideas: a) Do bio_endio() rather than bio_put() in blk_rq_unprep_clone() and let bi_end_io reap additional data. It looks ugly. b) Separate the constructor from blk_rq_prep_clone(). dm has to do rq_for_each_bio loop again for constructor. Possible performance impact. c) Open code blk_rq_prep/unprep_clone() in dm. It exposes unnecessary block-internals to dm. d) Pass destructor function to blk_rq_prep/unprep_clone() for them to callback. Umm, is "d)" better? -- Jun'ichi Nomura, NEC Corporation From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from zimbra.linbit.com (zimbra.linbit.com [212.69.161.123]) by mail09.linbit.com (LINBIT Mail Daemon) with ESMTP id 0B73E1005420 for ; Thu, 24 May 2012 18:15:47 +0200 (CEST) Received: from localhost (localhost [127.0.0.1]) by zimbra.linbit.com (Postfix) with ESMTP id 04B441B4268 for ; Thu, 24 May 2012 18:15:47 +0200 (CEST) Received: from zimbra.linbit.com ([127.0.0.1]) by localhost (zimbra.linbit.com [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id wtmwx4Z8uYpV for ; Thu, 24 May 2012 18:15:46 +0200 (CEST) Received: from soda.linbit (tuerlsteher.linbit.com [86.59.100.100]) by zimbra.linbit.com (Postfix) with ESMTP id DA68D1B4262 for ; Thu, 24 May 2012 18:15:46 +0200 (CEST) Resent-Message-ID: <20120524161546.GS5734@soda.linbit> Received: from tyo201.gate.nec.co.jp (TYO201.gate.nec.co.jp [202.32.8.193]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) by mail09.linbit.com (LINBIT Mail Daemon) with ESMTPS id BDBD11013802 for ; Thu, 24 May 2012 03:16:48 +0200 (CEST) Message-ID: <4FBD8BD9.8070708@ce.jp.nec.com> Date: Thu, 24 May 2012 10:16:09 +0900 From: "Jun'ichi Nomura" MIME-Version: 1.0 To: Kent Overstreet References: <1337817771-25038-1-git-send-email-koverstreet@google.com> <1337817771-25038-3-git-send-email-koverstreet@google.com> <4FBD7E80.4020005@ce.jp.nec.com> <20120524003915.GA27443@google.com> In-Reply-To: <20120524003915.GA27443@google.com> Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit Cc: axboe@kernel.dk, device-mapper development , linux-kernel@vger.kernel.org, tj@kernel.org, linux-bcache@vger.kernel.org, mpatocka@redhat.com, agk@redhat.com, bharrosh@panasas.com, linux-fsdevel@vger.kernel.org, yehuda@hq.newdream.net, drbd-dev@lists.linbit.com, vgoyal@redhat.com, sage@newdream.net Subject: Re: [Drbd-dev] [dm-devel] [PATCH v2 02/14] dm: kill dm_rq_bio_destructor List-Id: Coordination of development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , On 05/24/12 09:39, Kent Overstreet wrote: > On Thu, May 24, 2012 at 09:19:12AM +0900, Jun'ichi Nomura wrote: >> The destructor may also be called from blk_rq_unprep_clone(), >> which just puts bio. >> So this patch will introduce a memory leak. > > Well, keeping around bi_destructor solely for that reason would be > pretty lousy. Can you come up with a better solution? I don't have good one but here are some ideas: a) Do bio_endio() rather than bio_put() in blk_rq_unprep_clone() and let bi_end_io reap additional data. It looks ugly. b) Separate the constructor from blk_rq_prep_clone(). dm has to do rq_for_each_bio loop again for constructor. Possible performance impact. c) Open code blk_rq_prep/unprep_clone() in dm. It exposes unnecessary block-internals to dm. d) Pass destructor function to blk_rq_prep/unprep_clone() for them to callback. Umm, is "d)" better? -- Jun'ichi Nomura, NEC Corporation From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S932388Ab2EXBQk (ORCPT ); Wed, 23 May 2012 21:16:40 -0400 Received: from TYO201.gate.nec.co.jp ([202.32.8.193]:48638 "EHLO tyo201.gate.nec.co.jp" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S932071Ab2EXBQi (ORCPT ); Wed, 23 May 2012 21:16:38 -0400 Message-ID: <4FBD8BD9.8070708@ce.jp.nec.com> Date: Thu, 24 May 2012 10:16:09 +0900 From: "Jun'ichi Nomura" User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:12.0) Gecko/20120430 Thunderbird/12.0.1 MIME-Version: 1.0 To: Kent Overstreet CC: device-mapper development , linux-kernel@vger.kernel.org, linux-bcache@vger.kernel.org, linux-fsdevel@vger.kernel.org, axboe@kernel.dk, yehuda@hq.newdream.net, mpatocka@redhat.com, vgoyal@redhat.com, bharrosh@panasas.com, tj@kernel.org, sage@newdream.net, agk@redhat.com, drbd-dev@lists.linbit.com Subject: Re: [dm-devel] [PATCH v2 02/14] dm: kill dm_rq_bio_destructor References: <1337817771-25038-1-git-send-email-koverstreet@google.com> <1337817771-25038-3-git-send-email-koverstreet@google.com> <4FBD7E80.4020005@ce.jp.nec.com> <20120524003915.GA27443@google.com> In-Reply-To: <20120524003915.GA27443@google.com> Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 05/24/12 09:39, Kent Overstreet wrote: > On Thu, May 24, 2012 at 09:19:12AM +0900, Jun'ichi Nomura wrote: >> The destructor may also be called from blk_rq_unprep_clone(), >> which just puts bio. >> So this patch will introduce a memory leak. > > Well, keeping around bi_destructor solely for that reason would be > pretty lousy. Can you come up with a better solution? I don't have good one but here are some ideas: a) Do bio_endio() rather than bio_put() in blk_rq_unprep_clone() and let bi_end_io reap additional data. It looks ugly. b) Separate the constructor from blk_rq_prep_clone(). dm has to do rq_for_each_bio loop again for constructor. Possible performance impact. c) Open code blk_rq_prep/unprep_clone() in dm. It exposes unnecessary block-internals to dm. d) Pass destructor function to blk_rq_prep/unprep_clone() for them to callback. Umm, is "d)" better? -- Jun'ichi Nomura, NEC Corporation