From patchwork Wed Dec 30 18:14:30 2009 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Hugh Dickins X-Patchwork-Id: 70283 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by demeter.kernel.org (8.14.3/8.14.2) with ESMTP id nBUIEb9R015692 for ; Wed, 30 Dec 2009 18:14:37 GMT Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752739AbZL3SOg (ORCPT ); Wed, 30 Dec 2009 13:14:36 -0500 Received: (majordomo@vger.kernel.org) by vger.kernel.org id S1752486AbZL3SOf (ORCPT ); Wed, 30 Dec 2009 13:14:35 -0500 Received: from mk-filter-2-a-1.mail.uk.tiscali.com ([212.74.100.53]:42496 "EHLO mk-filter-2-a-1.mail.uk.tiscali.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752576AbZL3SOf (ORCPT ); Wed, 30 Dec 2009 13:14:35 -0500 X-Trace: 317527019/mk-filter-2.mail.uk.tiscali.com/B2C/$b2c-THROTTLED-DYNAMIC/b2c-CUSTOMER-DYNAMIC-IP/79.69.28.176/None/hugh.dickins@tiscali.co.uk X-SBRS: None X-RemoteIP: 79.69.28.176 X-IP-MAIL-FROM: hugh.dickins@tiscali.co.uk X-SMTP-AUTH: X-Originating-Country: GB/UNITED KINGDOM X-MUA: Alpine 2.00 (LSU 1167 2008-08-23) X-IP-BHB: Once X-IronPort-Anti-Spam-Filtered: true X-IronPort-Anti-Spam-Result: AnQBAPsmO0tPRRyw/2dsb2JhbAAI1yKEMQSBaA X-IronPort-AV: E=Sophos;i="4.47,476,1257120000"; d="scan'208";a="317527019" Received: from 79-69-28-176.dynamic.dsl.as9105.com (HELO [192.168.0.5]) ([79.69.28.176]) by smtp.tiscali.co.uk with ESMTP; 30 Dec 2009 18:14:31 +0000 Date: Wed, 30 Dec 2009 18:14:30 +0000 (GMT) From: Hugh Dickins X-X-Sender: hugh@sister.anvils To: Rik van Riel cc: Avi Kivity , dbareiro@gmx.net, KVM General Subject: Re: Memory usage with qemu-kvm-0.12.1.1 In-Reply-To: <4B37978F.5030009@redhat.com> Message-ID: References: <20091227155107.GK7104@defiant.freesoftware> <4B378546.6070104@redhat.com> <4B378C25.4070206@redhat.com> <4B378D6D.40505@redhat.com> <4B378F32.1050307@redhat.com> <4B379562.8060007@redhat.com> <4B37978F.5030009@redhat.com> User-Agent: Alpine 2.00 (LSU 1167 2008-08-23) MIME-Version: 1.0 Sender: kvm-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: kvm@vger.kernel.org diff --git a/mm/vmscan.c b/mm/vmscan.c index 2ef59d5..0465818 100644 --- a/mm/vmscan.c +++ b/mm/vmscan.c @@ -1463,20 +1463,26 @@ static int inactive_file_is_low(struct zone *zone, struct scan_control *sc) return low; } +static int inactive_list_is_low(struct zone *zone, struct scan_control *sc, + int file) +{ + if (file) + return inactive_file_is_low(zone, sc); + else + return inactive_anon_is_low(zone, sc); +} + static unsigned long shrink_list(enum lru_list lru, unsigned long nr_to_scan, struct zone *zone, struct scan_control *sc, int priority) { int file = is_file_lru(lru); - if (lru == LRU_ACTIVE_FILE && inactive_file_is_low(zone, sc)) { - shrink_active_list(nr_to_scan, zone, sc, priority, file); + if (is_active_lru(lru)) { + if (inactive_list_is_low(zone, sc, file)) + shrink_active_list(nr_to_scan, zone, sc, priority, file); return 0; } - if (lru == LRU_ACTIVE_ANON && inactive_anon_is_low(zone, sc)) { - shrink_active_list(nr_to_scan, zone, sc, priority, file); - return 0; - } return shrink_inactive_list(nr_to_scan, zone, sc, priority, file); }