Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751654AbcLEIXp (ORCPT ); Mon, 5 Dec 2016 03:23:45 -0500 Received: from mail.free-electrons.com ([62.4.15.54]:42170 "EHLO mail.free-electrons.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751569AbcLEIXn (ORCPT ); Mon, 5 Dec 2016 03:23:43 -0500 Date: Mon, 5 Dec 2016 09:23:40 +0100 From: Boris Brezillon To: Artem Bityutskiy Cc: Richard Weinberger , Joe Perches , Marek Vasut , Pan Bian , David Woodhouse , Brian Norris , Cyrille Pitchen , linux-mtd@lists.infradead.org, linux-kernel@vger.kernel.org, Pan Bian Subject: Re: [PATCH 1/1] mtd: ubi: fix improper return value Message-ID: <20161205092340.6c119305@bbrezillon> In-Reply-To: <1480921774.2583.351.camel@gmail.com> References: <1480831930-5449-1-git-send-email-bianpan201604@163.com> <1480883619.4534.6.camel@perches.com> <0446c91c-ac84-3601-203a-9c2e7057f1f9@nod.at> <1480921774.2583.351.camel@gmail.com> X-Mailer: Claws Mail 3.13.2 (GTK+ 2.24.30; x86_64-pc-linux-gnu) MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 1271 Lines: 28 On Mon, 05 Dec 2016 09:09:34 +0200 Artem Bityutskiy wrote: > On Sun, 2016-12-04 at 21:52 +0100, Richard Weinberger wrote: > > We should better think about how to get ubi_self_check_all_ff() > > fixed. > > When enabled on a modern NAND, vmalloc() is likely to fail now and > > then > > since len is the erase block size and can be up to a few mega bytes. > > I did an attempt to switch from virtually continuous buffers to an > array of page pointers, but never finished. I started to implement that too but unfortunately never had the time to finish it :-(. Don't know why you were trying to move to kzalloc-ed buffer, but my goal was to avoid the extra copy when the controller transfers data using DMA, and the recent posts regarding vmalloc-ed buffers and DMA might solve the issue. This being said, UBI and UBIFS tend to allocate big portions of memory (usually a full eraseblock), and sometime this is overkill. For example, I'm not sure we need to allocate that much memory to do things like 'check if this portion is all filled with 0xff'. Allocating a ->max_write_size buffer and iterating over write-units should be almost as efficient and still consume less memory. But this has nothing to do with the vmalloc vs kmalloc debate ;-).