Received: by 2002:a25:8b91:0:0:0:0:0 with SMTP id j17csp3878540ybl; Mon, 9 Dec 2019 01:27:29 -0800 (PST) X-Google-Smtp-Source: APXvYqyCAwCQ83a7RSDsJ/glKyA2T6EizCe8W94ylUMkwO2jvN17qd87jB6frAvchWWqsn0lZpjx X-Received: by 2002:aca:edd5:: with SMTP id l204mr23884053oih.98.1575883649745; Mon, 09 Dec 2019 01:27:29 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1575883649; cv=none; d=google.com; s=arc-20160816; b=O7kHKq3WKWdwx9lREHJzmcDSTolMytK00pNIUsE/3g2oX7WMO2k9vInR3vFc3pN9ia o4oHdhZWFCJBtp0SjPY1NkVInl5FTZ6+xbJEeApmp4oh3M9QzGfL9CWgPyBffPC8O3KT TCFTVgHNLzBAAVuUEgVKMvRU4NctL52bfJbm2Yh7uNpfxTQgq+zWAcmT6TkC77zBeHv5 m0mDsoVEhPMSrDrVxVs6qIHAG88w62dFDVOzpK5hSVV6WIjk3OQzu6XvrIhvu+TwXM9t wBXJCw1w5dlTAKVyTAhDsCRp83jsC/86Vl8UdMvMVGfYjp7xbESuvPC9W2w+eFkcPIaC /ucQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:mime-version:message-id:date:subject:cc :to:from:ironport-sdr:dkim-signature; bh=LGTA5TBkns2swo7rzErYEaOZnrGxFvudwmigEUBWSbw=; b=tMBHRs5MAP88u4VURNhvz1ZPsCXCmwsUMqu8wHeqlUsTSlZKq/EDIFxbEFCJP+uukW 9GWVr6vXy+9tn1JldTPOtdUG+CBsi5GEMxcY8pSDMJGbRjiwQHd52uZvJy9WhKq3FAEu RN+RwJqWyNCooeEqDK1fckg5vV/d3Z5I8VCDYggjHKwBqcjQ2b4jwxoslsYknQbRwJdZ /0Zup98KoAcSfv4CmDsQLCR7Mp8q9+seQmiAKoNRS/RMWKuNXjNyyzv/3tvuemjmu4B4 wX7KuXRVoja+jAi92wLziYjqLVKq9nzvFsJTQrbE/5yao3RADwQX5pJnPBOHxv91cvFb cXHA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@amazon.com header.s=amazon201209 header.b=bq9Malpg; 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=QUARANTINE sp=QUARANTINE dis=NONE) header.from=amazon.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id h5si7510554oia.277.2019.12.09.01.27.17; Mon, 09 Dec 2019 01:27:29 -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=@amazon.com header.s=amazon201209 header.b=bq9Malpg; 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=QUARANTINE sp=QUARANTINE dis=NONE) header.from=amazon.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727381AbfLII7R (ORCPT + 99 others); Mon, 9 Dec 2019 03:59:17 -0500 Received: from smtp-fw-2101.amazon.com ([72.21.196.25]:16802 "EHLO smtp-fw-2101.amazon.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726377AbfLII7R (ORCPT ); Mon, 9 Dec 2019 03:59:17 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=amazon.com; i=@amazon.com; q=dns/txt; s=amazon201209; t=1575881957; x=1607417957; h=from:to:cc:subject:date:message-id:mime-version; bh=LGTA5TBkns2swo7rzErYEaOZnrGxFvudwmigEUBWSbw=; b=bq9MalpgtYVPszaKwKWPam2iaN4VtgL2S/AJaNjpRMmgUj6el5XF0dba th9oPnA4PyRyeljinM8C3EpJl1RMw8xCTvzvhbmcGpKh9cw473UNKbf1t s023OJ5WC5kwzp43bQdSboQooCnQUTIo7Dbi6FGZGp9lDslJv5TItIrGf g=; IronPort-SDR: dJUnx6CEDqktFiRuiiivz/Sg1VkDOSdNj1YmovhDEEj21n8RIw7fJ4f1q0sB0LgpCJeF+6bCPY PixdBF2EnBzw== X-IronPort-AV: E=Sophos;i="5.69,294,1571702400"; d="scan'208";a="7696916" Received: from iad6-co-svc-p1-lb1-vlan2.amazon.com (HELO email-inbound-relay-1a-715bee71.us-east-1.amazon.com) ([10.124.125.2]) by smtp-border-fw-out-2101.iad2.amazon.com with ESMTP; 09 Dec 2019 08:59:16 +0000 Received: from EX13MTAUEA001.ant.amazon.com (iad55-ws-svc-p15-lb9-vlan2.iad.amazon.com [10.40.159.162]) by email-inbound-relay-1a-715bee71.us-east-1.amazon.com (Postfix) with ESMTPS id E2691A1E75; Mon, 9 Dec 2019 08:59:13 +0000 (UTC) Received: from EX13D31EUA001.ant.amazon.com (10.43.165.15) by EX13MTAUEA001.ant.amazon.com (10.43.61.243) with Microsoft SMTP Server (TLS) id 15.0.1367.3; Mon, 9 Dec 2019 08:59:12 +0000 Received: from u886c93fd17d25d.ant.amazon.com (10.43.162.249) by EX13D31EUA001.ant.amazon.com (10.43.165.15) with Microsoft SMTP Server (TLS) id 15.0.1367.3; Mon, 9 Dec 2019 08:59:08 +0000 From: SeongJae Park To: , , CC: , , , , , SeongJae Park Subject: [PATCH v3 0/1] xen/blkback: Squeeze page pools if a memory pressure Date: Mon, 9 Dec 2019 09:58:38 +0100 Message-ID: <20191209085839.21215-1-sjpark@amazon.com> X-Mailer: git-send-email 2.17.1 MIME-Version: 1.0 Content-Type: text/plain X-Originating-IP: [10.43.162.249] X-ClientProxiedBy: EX13D29UWA001.ant.amazon.com (10.43.160.187) To EX13D31EUA001.ant.amazon.com (10.43.165.15) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Each `blkif` has a free pages pool for the grant mapping. The size of the pool starts from zero and be increased on demand while processing the I/O requests. If current I/O requests handling is finished or 100 milliseconds has passed since last I/O requests handling, it checks and shrinks the pool to not exceed the size limit, `max_buffer_pages`. Therefore, `blkfront` running guests can cause a memory pressure in the `blkback` running guest by attaching a large number of block devices and inducing I/O. System administrators can avoid such problematic situations by limiting the maximum number of devices each guest can attach. However, finding the optimal limit is not so easy. Improper set of the limit can results in the memory pressure or a resource underutilization. This commit avoids such problematic situations by squeezing the pools (returns every free page in the pool to the system) for a while (users can set this duration via a module parameter) if a memory pressure is detected. Base Version ------------ This patch is based on v5.4. A complete tree is also available at my public git repo: https://github.com/sjp38/linux/tree/blkback_aggressive_shrinking_v3 Patch History ------------- Changes from v2 (https://lore.kernel.org/linux-block/af195033-23d5-38ed-b73b-f6e2e3b34541@amazon.com) - Rename the module parameter and variables for brevity (aggressive shrinking -> squeezing) Changes from v1 (https://lore.kernel.org/xen-devel/20191204113419.2298-1-sjpark@amazon.com/) - Adjust the description to not use the term, `arbitrarily` (suggested by Paul Durrant) - Specify time unit of the duration in the parameter description, (suggested by Maximilian Heyne) - Change default aggressive shrinking duration from 1ms to 10ms - Merge two patches into one single patch SeongJae Park (1): xen/blkback: Squeeze page pools if a memory pressure is detected drivers/block/xen-blkback/blkback.c | 35 +++++++++++++++++++++++++++-- 1 file changed, 33 insertions(+), 2 deletions(-) -- 2.17.1