Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754197AbcC2WBw (ORCPT ); Tue, 29 Mar 2016 18:01:52 -0400 Received: from mx0a-00082601.pphosted.com ([67.231.145.42]:33905 "EHLO mx0a-00082601.pphosted.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752672AbcC2WBu (ORCPT ); Tue, 29 Mar 2016 18:01:50 -0400 Date: Tue, 29 Mar 2016 15:01:10 -0700 From: Shaohua Li To: Christoph Hellwig CC: , , , , "4.2+" , Ming Lei Subject: Re: [PATCH] block: don't make BLK_DEF_MAX_SECTORS too big Message-ID: <20160329220053.GA1716708@devbig084.prn1.facebook.com> References: <21cf85d32278bbe5acbc3def0a6db75db98a2670.1459269590.git.shli@fb.com> <20160329211833.GA18532@infradead.org> MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Disposition: inline In-Reply-To: <20160329211833.GA18532@infradead.org> User-Agent: Mutt/1.5.20 (2009-12-10) X-Originating-IP: [192.168.52.123] X-Proofpoint-Spam-Reason: safe X-FB-Internal: Safe X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10432:,, definitions=2016-03-29_09:,, signatures=0 Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 1185 Lines: 21 On Tue, Mar 29, 2016 at 02:18:33PM -0700, Christoph Hellwig wrote: > On Tue, Mar 29, 2016 at 09:42:33AM -0700, Shaohua Li wrote: > > bio_alloc_bioset() allocates bvecs from bvec_slabs which can only > > allocate maximum 256 bvec (eg, 1M for 4k pages). We can't bump > > BLK_DEF_MAX_SECTORS to exceed this value otherwise bio_alloc_bioset will > > fail. > > This might be true, but it's not a good enough reason. Request based > driver couldn't care less about the limits of bio_alloc_bioset. > > It seems the bug is that somone (would be great to know whoe exactly) > passes a too large value to bio_alloc_bioset. And given that we still > have bio_add_page around for actually adding pages to a bio it seems > like the proper fix would be to simply clamp down the actual allocation > and segment limit inside bio_alloc_bioset. Which would also help to > eventually remove code doing just that in tons of callers. The problem is bcache allocates a big bio (with bio_alloc). The bio is split with blk_queue_split, but it isn't split to small size because queue limit. the bio is cloned later in md, which uses bio_alloc_bioset. bio_alloc_bioset itself can't allocate big size bio.