From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1757429AbbFQQLc (ORCPT ); Wed, 17 Jun 2015 12:11:32 -0400 Received: from mx1.redhat.com ([209.132.183.28]:54808 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1754096AbbFQQLY (ORCPT ); Wed, 17 Jun 2015 12:11:24 -0400 Message-ID: <55819C27.4050404@redhat.com> Date: Wed, 17 Jun 2015 18:11:19 +0200 From: Paolo Bonzini User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:31.0) Gecko/20100101 Thunderbird/31.6.0 MIME-Version: 1.0 To: Xiao Guangrong CC: gleb@kernel.org, mtosatti@redhat.com, kvm@vger.kernel.org, linux-kernel@vger.kernel.org, dmatlack@google.com Subject: Re: [PATCH v2 11/15] KVM: MTRR: sort variable MTRRs References: <1434358535-19923-1-git-send-email-guangrong.xiao@linux.intel.com> <1434358535-19923-12-git-send-email-guangrong.xiao@linux.intel.com> In-Reply-To: <1434358535-19923-12-git-send-email-guangrong.xiao@linux.intel.com> Content-Type: text/plain; charset=windows-1252 Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 15/06/2015 10:55, Xiao Guangrong wrote: > + /* add it to the list if it's valid. */ > + if (var_mtrr_range_is_valid(&mtrr_state->var_ranges[index])) { > + list_for_each_entry(tmp, &mtrr_state->head, node) > + if (cur->base < tmp->base) > + list_add_tail(&cur->node, &tmp->node); > + list_add_tail(&cur->node, &mtrr_state->head); Also, this loop looks weird. Is this what you wanted? list_for_each_entry(tmp, &mtrr_state->head, node) if (cur->base >= tmp->base) break; list_add_tail(&cur->node, &tmp->node); If so, can you look at kvm/queue and see if it is okay for you (so that we can get the series in 4.2)? Paolo > + } > +}