Received: by 2002:ad5:474a:0:0:0:0:0 with SMTP id i10csp9213760imu; Wed, 5 Dec 2018 00:34:02 -0800 (PST) X-Google-Smtp-Source: AFSGD/Vl3tsPENHxD4aaXx8R/ueAOvtl7r7rtayvLOrzKBmJFzhLWhlX7n4yPGl5X1xFkuHZNjgV X-Received: by 2002:a63:4b25:: with SMTP id y37mr20275591pga.181.1543998842343; Wed, 05 Dec 2018 00:34:02 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1543998842; cv=none; d=google.com; s=arc-20160816; b=p38s3o7KszCf4pSVIlrMV9pDxxsW72dTK6EVm0AswTEoxH3bVLD0Dc8RGaGmx+pxIC qvHPGxmX2wlg86YjdFd7pqO3BdRpddDCNsO3JSQCawjR2OS/m41tcA5o7AkDyI8giljJ +gxmzsPHqWVcQcpa5tfmytBgMmfvhhg/GQMILi5EDMIvuGNwnx2syE1H2qXKcqS8BPK3 L+USIe8Xouu/6tDQ0BxdtQJuddZuZAzrXOGFdZ1GtgTuov29K3Ew3BkU699odrEcFv7p MimnUt2GegEaOJl0Lcw0SsqSBLED7ebsLHDUuJg7J4kuC//MZFY2BtXFskm6TeK3ui6N Ae/Q== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:in-reply-to :content-disposition:mime-version:references:message-id:subject:cc :to:from:date; bh=UWQvG6iOTg3Htpu7YwA//2TaFEjx6IMlqDfAfnbxN7o=; b=rhkrPsL4h0QC3CY8Xvm9tNVXkEsm8+qUR/fa3sJYl77WBv008IRHRNtDCscoHEgroA 2ecRb5FDPKKesJXQl5eR4zN7PfSFmpcGUrTO87k/Tr6no8Ucaa6aWubMmgjQMfRkQD7K zl7/nGedgNR0acYddmQpvbNMyYqw9Lc8isuCrm6IpqPQ8D1DmULLp5sWG4ZZdlMOF+NA VeE1zvodfULIH6qLZeikF/VamZqI5KrFKSq2crjjMbq9bXy+Ct97IWVyAZAHs2OD/pFu Q9AuBbZiFdWrotaXIRhGbhttT4aHaB07YW3TlVMi+g5m4JJLfre8QcSWV79dBoiHXvct ljRw== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=redhat.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id y12si17758953pgh.289.2018.12.05.00.33.46; Wed, 05 Dec 2018 00:34:02 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=redhat.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727242AbeLEIck (ORCPT + 99 others); Wed, 5 Dec 2018 03:32:40 -0500 Received: from mx1.redhat.com ([209.132.183.28]:56070 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726171AbeLEIck (ORCPT ); Wed, 5 Dec 2018 03:32:40 -0500 Received: from smtp.corp.redhat.com (int-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.11]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 622433082B23; Wed, 5 Dec 2018 08:32:40 +0000 (UTC) Received: from kamzik.brq.redhat.com (unknown [10.43.2.160]) by smtp.corp.redhat.com (Postfix) with ESMTPS id DC8BF6012C; Wed, 5 Dec 2018 08:32:38 +0000 (UTC) Date: Wed, 5 Dec 2018 09:32:36 +0100 From: Andrew Jones To: Peng Hao Cc: christoffer.dall@arm.com, marc.zyngier@arm.com, kvmarm@lists.cs.columbia.edu, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH] kvm/arm: return 0 when the number of objects is not less than min Message-ID: <20181205083236.5tzhnxfhi4h4nknn@kamzik.brq.redhat.com> References: <1543972551-60951-1-git-send-email-peng.hao2@zte.com.cn> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <1543972551-60951-1-git-send-email-peng.hao2@zte.com.cn> User-Agent: NeoMutt/20180716 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.11 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.45]); Wed, 05 Dec 2018 08:32:40 +0000 (UTC) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Wed, Dec 05, 2018 at 09:15:51AM +0800, Peng Hao wrote: > Return 0 when there is enough kvm_mmu_memory_cache object. > > Signed-off-by: Peng Hao > --- > virt/kvm/arm/mmu.c | 2 +- > 1 file changed, 1 insertion(+), 1 deletion(-) > > diff --git a/virt/kvm/arm/mmu.c b/virt/kvm/arm/mmu.c > index ed162a6..fcda0ce 100644 > --- a/virt/kvm/arm/mmu.c > +++ b/virt/kvm/arm/mmu.c > @@ -127,7 +127,7 @@ static int mmu_topup_memory_cache(struct kvm_mmu_memory_cache *cache, > while (cache->nobjs < max) { > page = (void *)__get_free_page(PGALLOC_GFP); > if (!page) > - return -ENOMEM; > + return cache->nobjs >= min ? 0 : -ENOMEM; This condition will never be true here, as the exact same condition is already checked above, and if it had been true, then we wouldn't be here. What problem are you attempting to solve? > cache->objects[cache->nobjs++] = page; > } > return 0; > -- > 1.8.3.1 > > _______________________________________________ > kvmarm mailing list > kvmarm@lists.cs.columbia.edu > https://lists.cs.columbia.edu/mailman/listinfo/kvmarm