Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751372AbcLEJuX (ORCPT ); Mon, 5 Dec 2016 04:50:23 -0500 Received: from mga09.intel.com ([134.134.136.24]:65085 "EHLO mga09.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751688AbcLEJuB (ORCPT ); Mon, 5 Dec 2016 04:50:01 -0500 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.33,747,1477983600"; d="scan'208";a="38948536" Message-ID: <1480931395.2583.359.camel@gmail.com> Subject: Re: [PATCH 1/1] mtd: ubi: fix improper return value From: Artem Bityutskiy Reply-To: dedekind1@gmail.com To: Boris Brezillon 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 Date: Mon, 05 Dec 2016 11:49:55 +0200 In-Reply-To: <20161205092340.6c119305@bbrezillon> 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> <20161205092340.6c119305@bbrezillon> Content-Type: text/plain; charset="UTF-8" X-Mailer: Evolution 3.20.5 (3.20.5-1.fc24) Mime-Version: 1.0 Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 1372 Lines: 36 On Mon, 2016-12-05 at 09:23 +0100, Boris Brezillon wrote: > 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. Yes, I wanted to do that globally for UBI/UBIFS to get rid of vmalloc. > This being said, UBI and UBIFS tend to allocate big portions of > memory (usually a full eraseblock), and sometime this is > overkill. Those checks were just hacky debugging functions at the beginning, then they got cleaned up without a re-write. > 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'. Because memcmp() is was very easy to use. Back then the focus was getting other things work well, and efforts were saved on less important parts. And 128KiB was not terribly bad. Today, these less important things are important. > 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 ;-). Well, this is related. Someone may start small and take care of these first :-) Artem.