From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752234AbbDLTxP (ORCPT ); Sun, 12 Apr 2015 15:53:15 -0400 Received: from a.ns.miles-group.at ([95.130.255.143]:65275 "EHLO radon.swed.at" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751877AbbDLTxO (ORCPT ); Sun, 12 Apr 2015 15:53:14 -0400 Message-ID: <552ACD28.8000409@nod.at> Date: Sun, 12 Apr 2015 21:53:12 +0200 From: Richard Weinberger User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:31.0) Gecko/20100101 Thunderbird/31.6.0 MIME-Version: 1.0 To: Boris Brezillon CC: linux-mtd@lists.infradead.org, linux-kernel@vger.kernel.org, dedekind1@gmail.com Subject: Re: [PATCH 4/4] UBI: Implement bitrot checking References: <1427631197-23610-1-git-send-email-richard@nod.at> <1427631197-23610-5-git-send-email-richard@nod.at> <20150412190119.7f0f7c64@bbrezillon> <552AA6B7.3070806@nod.at> <20150412212050.2949b6f5@bbrezillon> In-Reply-To: <20150412212050.2949b6f5@bbrezillon> Content-Type: text/plain; charset=windows-1252 Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Am 12.04.2015 um 21:20 schrieb Boris Brezillon: > Unless I'm missing something, it should be pretty easy to implement: > adding the following lines at the end of bitrot_check_worker() should do > the trick > > if (e->pnum + 1 < ubi->peb_count) { > wl_wrk->e = ubi->lookuptbl[e->pnum + 1]; > __schedule_ubi_work(ubi, wl_wrk); > } else { > atomic_dec(&ubi->bit_rot_work); > } > It will suffer from the same race issue as my current approach. While e is scheduled another worker could free it in case of an fatal error. >> I'd like to avoid works which schedule again other works. >> In the current way it is clear where the work is scheduled and how much. > > Yes, but the memory consumption induced by this approach can be pretty > big on modern NAND chips (on 32 bit platforms, ubi_work is 32 octets > large, and on modern NANDs you often have 4096 blocks, so a UBI device > of 4000 block is pretty common => 4000 * 32 = 125 KiB). While I agree that consuming memory is not very nice I don't think that 125KiB is a big deal. > For standard wear leveling requests, using a ubi_work per request is > sensible since you can't know in advance which block will be queued for > wear-leveling operation next time. > In your case, you're scanning all blocks in ascending order, which > makes it a good candidate for this 'one work for all bitrot checks' > approach. The good news is that I have an idea to solve both problems the race and the memory issue. It should be pretty easy to implement. Patches will materialize in a few days. Thanks, //richard