Received: by 2002:a05:6a10:1287:0:0:0:0 with SMTP id d7csp1320518pxv; Fri, 16 Jul 2021 06:47:35 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxpJw3Aq/JAJVAWsE6csWUb2MeNP0Yxl5rfbGxlotY01ulLCPt2HD6wEG/eTJBifNJc8rT8 X-Received: by 2002:a05:6e02:1208:: with SMTP id a8mr6533677ilq.257.1626443254899; Fri, 16 Jul 2021 06:47:34 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1626443254; cv=none; d=google.com; s=arc-20160816; b=Ox0+1ST0g2WdtFwetAliReOsYhG3hY3RihxKz4pJSzZ5ZxPHDwiOO1a+h9QbDkFPRl 1r/FZXGCpWfgjkZDnaUcQb2iWinW1nEI94S5iIsClID9HJ9C00GOBKfciXjACHDJFqCA ZkP1DO3m9y78ISOX1eyszWLy3Iym3VL+/CAUkMxdqL8aTaPr3VvHLtyj/1V06M1KFCiW //3a23ViMqXBVZZszXC3afzvXLbJZFF+l/ZOUHhiNYP3aE7haroT95M7JCIqyAMyIkaK TZxHYXIkus3HYxw34kZM8zJ9GOravmnzsF77B3bV5StLRslz5oBI1RkYczt706mMIx/c pQ8w== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-disposition:mime-version :references:message-id:subject:cc:to:from:date:dkim-signature; bh=c1tfWnlHj4mVpO7olTLAtvsBtx52Zsghaz5hp48XnhQ=; b=gsSM6GUxCOEyBQ7kupxq82J7gL78/sTy6bthnkMumPNiQhZYjuRLqSFBcFH8q7PJd7 z9o8uRhNawEpT63SBtvBw4woz0IRJrbnbPsGm3UUCjkoqu0EuC2ainh7gucKP2GoI0O7 HKJY2rNTlLSs2JNNLxLAyDm2fXwg8dmHyc6rS3gtZjkaj92wccPD0Z4KHX+BLyu2lSaI 84KNH7Ss7WYIRV8ZBvHw4c8MEcScc3AiNnOq6hzZTG/80yTBM6QXikJoVnKyoGHwabOp 8s2Q3lY1cqxcHXGOBvbUMi9rww6hhEv2qcjAHgj+BIvkltuzI5m7vFenOt6fV+SCY6bO 1AXA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@suse.com header.s=susede1 header.b=RSBi5lWk; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=QUARANTINE sp=NONE dis=NONE) header.from=suse.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id f17si9945197ion.28.2021.07.16.06.47.20; Fri, 16 Jul 2021 06:47:34 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@suse.com header.s=susede1 header.b=RSBi5lWk; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=QUARANTINE sp=NONE dis=NONE) header.from=suse.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232895AbhGPNtk (ORCPT + 99 others); Fri, 16 Jul 2021 09:49:40 -0400 Received: from smtp-out2.suse.de ([195.135.220.29]:51796 "EHLO smtp-out2.suse.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232808AbhGPNtk (ORCPT ); Fri, 16 Jul 2021 09:49:40 -0400 Received: from relay2.suse.de (relay2.suse.de [149.44.160.134]) by smtp-out2.suse.de (Postfix) with ESMTP id 699491FEA9; Fri, 16 Jul 2021 13:46:44 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.com; s=susede1; t=1626443204; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=c1tfWnlHj4mVpO7olTLAtvsBtx52Zsghaz5hp48XnhQ=; b=RSBi5lWkSGn4UfpBBEcNzs9qgd0A7ijXRR9Po3tyoeU461KU/J2Id8S4kFgXVo9DqRlGwJ rW9WKyKZJyATJNxsYJxZugZnqo3mC8CHbh8/fIXWb3wGTqfuQgiFzRvgNCgsNtqNJ0PKC/ J5HoyGiSSqi0irGRQfMhVzj+O9WV7u4= Received: from suse.cz (unknown [10.100.216.66]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by relay2.suse.de (Postfix) with ESMTPS id 07FA1A3BB3; Fri, 16 Jul 2021 13:46:44 +0000 (UTC) Date: Fri, 16 Jul 2021 15:46:43 +0200 From: Petr Mladek To: Yury Norov Cc: Steven Rostedt , linux-kernel@vger.kernel.org, Andy Shevchenko , Rasmus Villemoes , Sergey Senozhatsky , Tejun Heo Subject: Re: [PATCH 2/2] bitmap: introduce for_each_set_bitrange Message-ID: References: <20210709034519.2859777-1-yury.norov@gmail.com> <20210709034519.2859777-3-yury.norov@gmail.com> <20210709095950.6a451ccb@oasis.local.home> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Thu 2021-07-15 08:50:21, Yury Norov wrote: > On Fri, Jul 09, 2021 at 09:59:50AM -0400, Steven Rostedt wrote: > > On Thu, 8 Jul 2021 20:45:19 -0700 > > Yury Norov wrote: > > > > > bitmap_list_string() is very ineffective when printing bitmaps with long > > > ranges of set bits because it calls find_next_bit for each bit. We can do > > > better by detecting ranges of set bits. > > > diff --git a/lib/vsprintf.c b/lib/vsprintf.c > > > index 87acf66f0e4c..1ee54dace71e 100644 > > > --- a/lib/vsprintf.c > > > +++ b/lib/vsprintf.c > > > > > > - buf = number(buf, end, rtop, default_dec_spec); > > > - } > > > + if (buf > start) > > > + buf--; > > > > If the above is to undo the last comma, please put back the first logic. > > You're asking me to move part of the logic inside the loop which generally > should be avoided. Is there any particular reason to do this? vsprintf() should write what is needed and keep the rest of the given buffer intact. There is even a test for this in the test_printf module. I think that test_printf does not complain here because only a single character is used and it is later replaced by the trailing '\0'. By other words, undoing the last comma does not cause visible problems in the end. But from vsprintf() point of view, it is a hack that does not trigger the warning only by chance. And it is better to avoid it. Best Regards, Petr