From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by smtp.lore.kernel.org (Postfix) with ESMTP id C3056C05027 for ; Thu, 2 Feb 2023 13:18:35 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id CD61E6B0071; Thu, 2 Feb 2023 08:18:34 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id C85CB6B0072; Thu, 2 Feb 2023 08:18:34 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id B4D836B0073; Thu, 2 Feb 2023 08:18:34 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0010.hostedemail.com [216.40.44.10]) by kanga.kvack.org (Postfix) with ESMTP id A3FF26B0071 for ; Thu, 2 Feb 2023 08:18:34 -0500 (EST) Received: from smtpin04.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay02.hostedemail.com (Postfix) with ESMTP id 67D76120975 for ; Thu, 2 Feb 2023 13:18:34 +0000 (UTC) X-FDA: 80422406148.04.C01D363 Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.129.124]) by imf12.hostedemail.com (Postfix) with ESMTP id B26AA40009 for ; Thu, 2 Feb 2023 13:18:31 +0000 (UTC) Authentication-Results: imf12.hostedemail.com; dkim=pass header.d=redhat.com header.s=mimecast20190719 header.b=CEsxkYEU; spf=pass (imf12.hostedemail.com: domain of bhe@redhat.com designates 170.10.129.124 as permitted sender) smtp.mailfrom=bhe@redhat.com; dmarc=pass (policy=none) header.from=redhat.com ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1675343912; h=from:from:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-type:content-transfer-encoding: in-reply-to:in-reply-to:references:references:dkim-signature; bh=e1n69l0Tsv3jdN8ixpLREkwCQQl25Z7S/pkWfXRxnkY=; b=IwINU2QtiG/9mO0CsOiowDuV6g+8tbFNO+djKr2n2EJLjwdvY1Br5HYbRJawtXf3y+N74D NzXxm/VUWTGOtu7hTHPafOKGfyfQIdTPM72kt9A3uyuobgMW91j2PP3Q+IRotD68njsUy5 1AWdJf6KkwNsiDWZ+fnV3qZXmxa2aZo= ARC-Authentication-Results: i=1; imf12.hostedemail.com; dkim=pass header.d=redhat.com header.s=mimecast20190719 header.b=CEsxkYEU; spf=pass (imf12.hostedemail.com: domain of bhe@redhat.com designates 170.10.129.124 as permitted sender) smtp.mailfrom=bhe@redhat.com; dmarc=pass (policy=none) header.from=redhat.com ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1675343912; a=rsa-sha256; cv=none; b=gIbQFNWqPpW/d6IJATR1Djc+V/N27wn4ed2QfiXi4IbTS1H/bdHO4+lo3dv2mVQoOHV8Ko H+E6mJDNWTyh3Y3DYURHtzEUnrgXuEb1m1QGB9VFuxfaRSoxTCEcVI/jOpB/feG6E4VIjD lUApZ4s1WSngN2l0CW07OwX6ZUp+cIs= DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1675343911; h=from:from:reply-to:subject:subject: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=e1n69l0Tsv3jdN8ixpLREkwCQQl25Z7S/pkWfXRxnkY=; b=CEsxkYEUvkxyJLxd1UjE1SFc+gwFAgPvUVH6q85+t6KU5kICLAjL3F0zpDlr6iTv6vGNFs yqLgIDEi3KG2xf+NBm5uuG035ixXwhsvwzdh0aoxUZO9IHtvW/IpmEIB9gba2lncUPVJpd +ekmAGrzadVYRyRRkokDJwuRW0WLNtA= Received: from mimecast-mx02.redhat.com (mimecast-mx02.redhat.com [66.187.233.88]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-259-A9u7YseVPj-x9ReRJpOfzA-1; Thu, 02 Feb 2023 08:18:27 -0500 X-MC-Unique: A9u7YseVPj-x9ReRJpOfzA-1 Received: from smtp.corp.redhat.com (int-mx08.intmail.prod.int.rdu2.redhat.com [10.11.54.8]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 335AD85C6F4; Thu, 2 Feb 2023 13:18:27 +0000 (UTC) Received: from localhost (ovpn-12-127.pek2.redhat.com [10.72.12.127]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 84B1DC15BA0; Thu, 2 Feb 2023 13:18:26 +0000 (UTC) Date: Thu, 2 Feb 2023 21:18:23 +0800 From: Baoquan He To: Lorenzo Stoakes Cc: linux-kernel@vger.kernel.org, linux-mm@kvack.org, akpm@linux-foundation.org, stephen.s.brennan@oracle.com, urezki@gmail.com, willy@infradead.org, hch@infradead.org, error27@gmail.com Subject: Re: [PATCH v4 3/7] mm/vmalloc.c: allow vread() to read out vm_map_ram areas Message-ID: References: <20230201091339.61761-1-bhe@redhat.com> <20230201091339.61761-4-bhe@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: X-Scanned-By: MIMEDefang 3.1 on 10.11.54.8 X-Rspamd-Server: rspam05 X-Rspamd-Queue-Id: B26AA40009 X-Stat-Signature: rzd1bef7x8rquy48hszqy8icf5gdbmxz X-Rspam-User: X-HE-Tag: 1675343911-865649 X-HE-Meta: U2FsdGVkX18VCinI0GOXieAMebAEU5xR5RHO4hJiqz1pLDsdycUYw0UghiP1wBft0BUqGVtTQYFB/h3RQS6qCk0sW4A0CipaC/egQQc5T7/3KE9/3eN5IIlvynI9RzAwvMd4gzmeNV8rba1nk/gG1twJAhrKCRBmZd71FjynyRty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uAQhZCPJHayRig5Tq7zK7VCjAMS6fk= X-Bogosity: Ham, tests=bogofilter, spamicity=0.000000, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: On 02/02/23 at 07:17am, Lorenzo Stoakes wrote: > On Thu, Feb 02, 2023 at 11:20:07AM +0800, Baoquan He wrote: > > [snip] > > > > > + for_each_set_bitrange(rs, re, vb->used_map, VMAP_BBMAP_BITS) { > > > > + if (!count) > > > > + break; > > > > + start = vmap_block_vaddr(vb->va->va_start, rs); > > > > + while (addr < start) { > > > > + if (count == 0) > > > > + break; > > > > > > Bit pedantic, but you're using the `if (!count)` form of checking whether it's > > > zero above, but here you explicitly check it, would be good to keep both consistent. > > > > Yeah, sounds good. Will change. > > > > > > > > Given you're checking here, perhaps you could simply drop the previous check? > > > > Well, maybe no. The previous "if (!count)" is checking if count is 0 > > after the 'count -=n;' line at the end of the for_each loop. While this > > "if (count == 0)" is checking if count is 0 after 'count--;' at the end > > of while loop. Not sure if I got your point. > > You're right, sorry each break is for a different loop :) and I guess the inner > check is feeding the outer one so we're all good. Oh, the inner check and break only terminates the while loop, but it should jump to the 'spin_unlock(&vb->lock);' line too as the outer break does. I will fix this.