Received: by 2002:a25:ad19:0:0:0:0:0 with SMTP id y25csp1836359ybi; Wed, 17 Jul 2019 22:53:44 -0700 (PDT) X-Google-Smtp-Source: APXvYqyyPNd3MV86vyp/wPFdUNmq/cL1pghwq9ym+DTQBlP17MqenMKCNA0Vhn4/1bBaCQJ1VTLy X-Received: by 2002:a17:90a:8d86:: with SMTP id d6mr48821455pjo.94.1563429224811; Wed, 17 Jul 2019 22:53:44 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1563429224; cv=none; d=google.com; s=arc-20160816; b=BaS8Y79EMtucFjhDx9VNf6ORJRjeP2mfwRb0+AB514/p2tVmqV1zZ3G4aRLKkEGZA5 PHExn9kRj+SK/h4ISJxW7ekl+vxEZbQ8Tfl0/Lq6T2AZ2i0Jha12LI0Mwm1iAiHTdMcH oLfFJctt+ooMW94ExNIelYo8qCVRVWR68HgN2qy0a/AJ32qdXbS0B8E9WBqmiezA4K7F MfA5bFdxGERNLt0mJUvzcZPz1JXBAo40EIFBmMwQZRsX3uWKnCmRHZIplnpVXjXBKwJ3 7p5nNuvMo+QUYlJFvSD5PpdI8fLqJKYKSZkzJ8HF7irOU3HRfpMsJjddUMKzvYJt7JT1 Jmng== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:in-reply-to :references:subject:cc:to:mime-version:user-agent:from:date :message-id; bh=bJ+P6l4sBWFG4da91ExsiJIOILHZRWwkDB2B+itWlwI=; b=KU3H5AZeMPHZFQk3024UmM3GYlckxm+FetH9XWbSmLqK8eUsMhbsY5H6/r0Z+UcNfu U7fV66PUeskyv8nxmG5SB9GEjGmr1UL2OrPwFb2cUxRRVJluumEo5jcY1WGVhg2hTCP3 hMRJ6rT0zp8spycHvMc0mg+xzws1elG5zDteL+UXYCQufwGSNMjayDILMintEOMwHVPL RFdUQVUSOqv+r46/srEnPmNER91e2Oor2eKl7rKyTJMNBpSXEL8PyofvOcsMKusmWk5p IGnoQEgYMr2yBwGg3rfRvpWqM7al86ewgomjaMcL5U5Z+JPtGZ1Uk5AH73BHzYGuvX4V Sing== 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 c3si114843pje.1.2019.07.17.22.53.28; Wed, 17 Jul 2019 22:53:44 -0700 (PDT) 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 S1728087AbfGRFvf (ORCPT + 99 others); Thu, 18 Jul 2019 01:51:35 -0400 Received: from mga02.intel.com ([134.134.136.20]:11596 "EHLO mga02.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725959AbfGRFvf (ORCPT ); Thu, 18 Jul 2019 01:51:35 -0400 X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from fmsmga006.fm.intel.com ([10.253.24.20]) by orsmga101.jf.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 17 Jul 2019 22:51:34 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.64,276,1559545200"; d="scan'208";a="367248561" Received: from unknown (HELO [10.239.13.7]) ([10.239.13.7]) by fmsmga006.fm.intel.com with ESMTP; 17 Jul 2019 22:51:30 -0700 Message-ID: <5D300A32.4090300@intel.com> Date: Thu, 18 Jul 2019 13:57:06 +0800 From: Wei Wang User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:31.0) Gecko/20100101 Thunderbird/31.7.0 MIME-Version: 1.0 To: "Michael S. Tsirkin" CC: Alexander Duyck , Nitesh Narayan Lal , kvm list , David Hildenbrand , "Hansen, Dave" , LKML , linux-mm , Andrew Morton , Yang Zhang , "pagupta@redhat.com" , Rik van Riel , Konrad Rzeszutek Wilk , "lcapitulino@redhat.com" , Andrea Arcangeli , Paolo Bonzini , "Williams, Dan J" , Alexander Duyck Subject: Re: use of shrinker in virtio balloon free page hinting References: <20190717071332-mutt-send-email-mst@kernel.org> <286AC319A985734F985F78AFA26841F73E16D4B2@shsmsx102.ccr.corp.intel.com> <20190718000434-mutt-send-email-mst@kernel.org> In-Reply-To: <20190718000434-mutt-send-email-mst@kernel.org> Content-Type: text/plain; charset=windows-1252; format=flowed Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 07/18/2019 12:13 PM, Michael S. Tsirkin wrote: > > It makes sense for pages in the balloon (requested by hypervisor). > However free page hinting can freeze up lots of memory for its own > internal reasons. It does not make sense to ask hypervisor > to set flags in order to fix internal guest issues. Sounds reasonable to me. Probably we could move the flag check to shrinker_count and shrinker_scan as a reclaiming condition for ballooning pages only? > > Right. But that does not include the pages in the hint vq, > which could be a significant amount of memory. I think it includes, as vb->num_free_page_blocks records the total number of free page blocks that balloon has taken from mm. For shrink_free_pages, it calls return_free_pages_to_mm, which pops pages from vb->free_page_list (this is the list where pages get enlisted after they are put to the hint vq, see get_free_page_and_send). > > >>> - if free pages are being reported, pages freed >>> by shrinker will just get re-allocated again >> fill_balloon will re-try the allocation after sleeping 200ms once allocation fails. > Even if ballon was never inflated, if shrinker frees some memory while > we are hinting, hint vq will keep going and allocate it back without > sleeping. Still see get_free_page_and_send. -EINTR is returned when page allocation fails, and reporting ends then. Shrinker is called on system memory pressure. On memory pressure get_free_page_and_send will fail memory allocation, so it stops allocating more. Best, Wei