Received: by 2002:a25:1506:0:0:0:0:0 with SMTP id 6csp1360263ybv; Thu, 6 Feb 2020 02:45:42 -0800 (PST) X-Google-Smtp-Source: APXvYqxbEE4wzIwrbPzccBAytDcEzpEfMEp2HoD/S7MzhTtjwiX4oM9cloleHdDzYcf+l4U3wMXs X-Received: by 2002:a9d:6ad6:: with SMTP id m22mr17402555otq.7.1580985941947; Thu, 06 Feb 2020 02:45:41 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1580985941; cv=none; d=google.com; s=arc-20160816; b=yk2JlRbloA82Eyo68iZa1sLgs/qb0UkA+9QAPgqHQ3b9TestlaHUcS+dHwVDB2xh+8 6Qz0r/Kp2ONOk1PSVlGnkZGbSzbZiM3kHSaz9h4qL/2+iaGFSGJZI4n9TEjTZ8ri0Mo6 FicoxC/OusIsiaV8ZCdldQ3PK08Qd1PaDWRfaGksWi+iBcFpX7nY2YJiYQIWXauH4BrT scLQZ/ep9RJ2hA8Ir9uMWUfqF3vphyT6SiBthx5EbzTQAknba3BbcOOwyc88T0s/rvkg HUU4tzQPLYAEtMyRViekjzbprjrkI/MYRk3holDOC4dMv8a6ITysE9dmQC0V7hfJvbyF ukkA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:mime-version:content-transfer-encoding :dlp-reaction:dlp-version:dlp-product:content-language :accept-language:in-reply-to:references:message-id:date:thread-index :thread-topic:subject:cc:to:from; bh=Gp2QDHf8PS1gt8NjrDzAPG1nH2yxW0/IWv/DB3AY7+s=; b=N2CCKfdoE7QDB8tg4PtGlusmoTIR8NzbwCWWNkcvC3owfRyyZObKQw+tSWyugs51cn JGnVCazsadeiM/SgmKz88c/4YexMX5s7OQM2tcuxDRdvFolqtVr82/z8fX/WRvAM8HNL x2AHNb2NxXQwAf4sYl5GmeZ24T1f3RDGhVr8zc2ULKt6lg1zKuxdQDQ5JG+eg/4cIRgp 6qObTYUCuQ2aEMmOge0WEaq6SMSKr3VT2MB+HYIJSci8anlgmVHEM4+29xVJSFeXALUl b1D67LJZED6a/qJ5CYV96L1L21BTyBC8WD52lTv6HHxZO3WDhAuCrjvq39laGvnxJtgq 3hHw== 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=intel.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id b191si1969211oii.266.2020.02.06.02.45.30; Thu, 06 Feb 2020 02:45:41 -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=intel.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728106AbgBFJ1L convert rfc822-to-8bit (ORCPT + 99 others); Thu, 6 Feb 2020 04:27:11 -0500 Received: from mga03.intel.com ([134.134.136.65]:12167 "EHLO mga03.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727920AbgBFJ1L (ORCPT ); Thu, 6 Feb 2020 04:27:11 -0500 X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from orsmga004.jf.intel.com ([10.7.209.38]) by orsmga103.jf.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 06 Feb 2020 01:27:10 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.70,409,1574150400"; d="scan'208";a="379016409" Received: from fmsmsx106.amr.corp.intel.com ([10.18.124.204]) by orsmga004.jf.intel.com with ESMTP; 06 Feb 2020 01:27:06 -0800 Received: from fmsmsx112.amr.corp.intel.com (10.18.116.6) by FMSMSX106.amr.corp.intel.com (10.18.124.204) with Microsoft SMTP Server (TLS) id 14.3.439.0; Thu, 6 Feb 2020 01:27:06 -0800 Received: from shsmsx103.ccr.corp.intel.com (10.239.4.69) by FMSMSX112.amr.corp.intel.com (10.18.116.6) with Microsoft SMTP Server (TLS) id 14.3.439.0; Thu, 6 Feb 2020 01:27:06 -0800 Received: from shsmsx102.ccr.corp.intel.com ([169.254.2.126]) by SHSMSX103.ccr.corp.intel.com ([169.254.4.196]) with mapi id 14.03.0439.000; Thu, 6 Feb 2020 17:27:04 +0800 From: "Wang, Wei W" To: "Michael S. Tsirkin" CC: "linux-kernel@vger.kernel.org" , "virtualization@lists.linux-foundation.org" , "tysand@google.com" , "david@redhat.com" , "alexander.h.duyck@linux.intel.com" , "rientjes@google.com" , "mhocko@kernel.org" , "namit@vmware.com" , "penguin-kernel@i-love.sakura.ne.jp" Subject: RE: [PATCH RFC] virtio_balloon: conservative balloon page shrinking Thread-Topic: [PATCH RFC] virtio_balloon: conservative balloon page shrinking Thread-Index: AQHV3Mq/N+pHUOUW3kyXc/hsfZBMQqgNWSSAgACHU1A= Date: Thu, 6 Feb 2020 09:27:04 +0000 Message-ID: <286AC319A985734F985F78AFA26841F73E4238A5@shsmsx102.ccr.corp.intel.com> References: <1580976107-16013-1-git-send-email-wei.w.wang@intel.com> <20200206035749-mutt-send-email-mst@kernel.org> In-Reply-To: <20200206035749-mutt-send-email-mst@kernel.org> Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: dlp-product: dlpe-windows dlp-version: 11.2.0.6 dlp-reaction: no-action x-originating-ip: [10.239.127.40] Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 8BIT MIME-Version: 1.0 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Thursday, February 6, 2020 5:04 PM, Michael S. Tsirkin wrote: > virtio_balloon_shrinker_count(struct shrinker *shrinker, > > struct virtio_balloon, shrinker); > > unsigned long count; > > > > - count = vb->num_pages / VIRTIO_BALLOON_PAGES_PER_PAGE; > > + if (conservative_shrinker && global_node_page_state(NR_FILE_PAGES)) > > I'd rather have an API for that in mm/. In particular, do we want other > shrinkers to run, not just pagecache? To pick an example I'm familiar > with, kvm mmu cache for nested virt? We could make it extendable: #define BALLOON_SHRINKER_AFTER_PAGE_CACHE (1 << 0) #define BALLOON_SHRINKER_AFTER_KVM_MMU_CACHE (1 << 1) ... uint64_t conservative_shrinker; if ((conservative_shrinker | BALLOON_SHRINKER_AFTER_PAGE_CACHE) && global_node_page_state(NR_FILE_PAGES)) return 0; For now, we probably only need BALLOON_SHRINKER_AFTER_PAGE_CACHE. Best, Wei