Received: by 2002:a25:1506:0:0:0:0:0 with SMTP id 6csp1360317ybv; Thu, 6 Feb 2020 02:45:46 -0800 (PST) X-Google-Smtp-Source: APXvYqw32IKho3KZclwrdjgKbbk3T3fiNb7JPkSUPMOQilEgV3EaOk9PejJBvbynaC+wi3UDi8Bb X-Received: by 2002:a9d:3cf:: with SMTP id f73mr29982041otf.11.1580985946256; Thu, 06 Feb 2020 02:45:46 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1580985946; cv=none; d=google.com; s=arc-20160816; b=lBQo0u0E9syPnKKx/A+rsZrFW4tjsVI6r0GgkDP5RgUhI7PVJRC1rWjIsQAE3M0Nlt iAvubGEfkWHer0L6jHXE8v0Y3uDpftAF6W+2BKOsOBtCct6roT5mdMaRq0ucqNYwOSBA Bco+92FXYMTuVNO9NGhlxZ4+3J5qe/LDFmb1e+E+mfP5xsJvZ1yHeIwx1dUNmL5KIgGt jFqxOWHP5/wrHETiZsUtzUobjDwgsfH49Ltcy64asIv+XeLTNXDo2x40GkDuBU3ZMU84 0gjPuGdNnee8WWiWfToFH+i+lzrxxrp77pZGzoFSMKzaURIgOLLdjEpYoHDYnxx7goaR mg9w== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:in-reply-to:content-disposition :mime-version:references:message-id:subject:cc:to:from:date :dkim-signature; bh=psVaYKxFuuF5hk8zbxTLl+GgL61u3jQrB7tk6Ar+Q/A=; b=bFZAHADpTW2DrLbtoTHuOvTu9rhBEn/8N1Y4rqGusSZpGvnqlihCQLrO2wYqOdOKet hubD/S6rO+4TsEYWT/S4bDunzBpMAd/qyc0DPA69RZG2oS/tnAA4mncLDaOQXj7TvcCu RlRZsmeIzcExicosFRYHIl/V2282n3+NlX65IZKvIWoHpSA2ZMeNUHCV10xMmlc+pjiT +iJ4zX8wvkxZxZi4FKt3Db0bhwy5W+q9eEJdR3EOVWtH0ADw3GmIKsaq735BlJOSNWOu RFhIyT8X43IB2TZA10Oo7Nrh8n0I5nPlSmgbFB0IPReOfDxHnn4RVve0CgcfE6R5MSQk bB8g== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=Cij1Afdc; 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=pass (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 j71si1641702oib.213.2020.02.06.02.45.34; Thu, 06 Feb 2020 02:45:46 -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; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=Cij1Afdc; 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=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728377AbgBFJbK (ORCPT + 99 others); Thu, 6 Feb 2020 04:31:10 -0500 Received: from us-smtp-1.mimecast.com ([207.211.31.81]:39335 "EHLO us-smtp-delivery-1.mimecast.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1727861AbgBFJbK (ORCPT ); Thu, 6 Feb 2020 04:31:10 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1580981469; 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=psVaYKxFuuF5hk8zbxTLl+GgL61u3jQrB7tk6Ar+Q/A=; b=Cij1AfdcV6LoNe53DOXTMjowUqXkr4kcalsvqr+glnedcMXKZjGzgLFTcK0OJYs1nIgFAU kws0VHL5WaHkUoYra35owuAKK7MIOcnNHdthAwPUt7DdbyUM/sZBFIuf0MVIB7PeF6yZfz eyIf1FTSX7Ys+zjoYNNVleLQ2+09Xlo= Received: from mail-qv1-f71.google.com (mail-qv1-f71.google.com [209.85.219.71]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-155-csAlQ1lhPH2j4XRZGSZmHw-1; Thu, 06 Feb 2020 04:31:07 -0500 X-MC-Unique: csAlQ1lhPH2j4XRZGSZmHw-1 Received: by mail-qv1-f71.google.com with SMTP id e26so3328387qvb.4 for ; Thu, 06 Feb 2020 01:31:07 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:in-reply-to; bh=psVaYKxFuuF5hk8zbxTLl+GgL61u3jQrB7tk6Ar+Q/A=; b=iVi2h1fXi79wUwSe/a4H7qfcTEseD3LSWBRwPG7zv8uw8ojKDXAimpVcAbobWd/WYB KYRydS3l8IZtLnqKxkbLXW53qOJk1XUg2O3lSTAvuHV6uyoAJfpp8I0qhMmo8J4jowAR S0W+ZYIImYId2bEIbZ4JzGGZ22MMm2qTnQomYdDzltQkY0vpwbpMKb/X4w7r0xYERIM5 ON0GVyKGwQPLJv6GQzVdI+5D/EXt9yP561cYPv2ipRCgfiBi4NTVMSJnlE8DbVuWTj9g 3QW7VeLECScQWRnAmvIhCGwW+A7AxNJDI25sutUOytInbTF/v8Wo7mY0OZfYkviV/zXz 4jsQ== X-Gm-Message-State: APjAAAUsi3EEBTTlX+sh7by/WAhyeAd78LsxwPgEKQgv0fVgDcZ9Djro 7rbn29jxu7upnzYe8DOtw0DGSWv0WzalxW/mVimugQfvCIQpVJQd6UeP8s3Y3oxvplzDdz0F/jw j2sQYxh9wz+i3qU3WRMQqabHR X-Received: by 2002:a05:6214:1633:: with SMTP id e19mr1574651qvw.104.1580981466901; Thu, 06 Feb 2020 01:31:06 -0800 (PST) X-Received: by 2002:a05:6214:1633:: with SMTP id e19mr1574635qvw.104.1580981466697; Thu, 06 Feb 2020 01:31:06 -0800 (PST) Received: from redhat.com (bzq-79-176-41-183.red.bezeqint.net. [79.176.41.183]) by smtp.gmail.com with ESMTPSA id o6sm1127547qkk.53.2020.02.06.01.31.03 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 06 Feb 2020 01:31:05 -0800 (PST) Date: Thu, 6 Feb 2020 04:31:01 -0500 From: "Michael S. Tsirkin" To: "Wang, Wei W" 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 Message-ID: <20200206042824-mutt-send-email-mst@kernel.org> References: <1580976107-16013-1-git-send-email-wei.w.wang@intel.com> <20200206035749-mutt-send-email-mst@kernel.org> <286AC319A985734F985F78AFA26841F73E4238A5@shsmsx102.ccr.corp.intel.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <286AC319A985734F985F78AFA26841F73E4238A5@shsmsx102.ccr.corp.intel.com> Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Thu, Feb 06, 2020 at 09:27:04AM +0000, Wang, Wei W wrote: > 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 How about just making this a last resort thing to be compatible with existing hypervisors? if someone wants to change behaviour that really should use a feature bit ... -- MST