Received: by 2002:a05:6a10:22f:0:0:0:0 with SMTP id 15csp2672745pxk; Mon, 14 Sep 2020 21:57:07 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzEKcD0t6pvFi9m3u53HAVScI9TY/F/qKO0Ewfsvhmg32B4dkKpTaGhy0Xln1XNytOKyJCq X-Received: by 2002:a05:6402:17b6:: with SMTP id j22mr19675335edy.377.1600145827462; Mon, 14 Sep 2020 21:57:07 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1600145827; cv=none; d=google.com; s=arc-20160816; b=cVlTtSFq6wrfR6P6ni+vxOEkhzmdEpBnI5A08KPj82/oUbqyrNa16l6mLRGU+Ki7q9 1K7lWKj9k1ztGw48SDrtLvSwYy3mk5csJ6p6WR/Sw+HPNWsj9esgCaKVo3cDUmjiEGd7 1xTxI35Oo3Iz+TEnoiTWKEjC2NIM3rb2PfN/cdTkIeqoSKTTe/ZAlAAxjKoCgU4X+97Y hf6p+nf6DstL+ts7Qwi61uxTTDEdI/4k0fpUt4r3sDa3Fwby5vPoLlCWJ+IiVN9Y9VJu LVHt+2F/shGk3lS+SA0OQq+JWNjrErTr6dMztJdx/qtf3/A8pMQMhdnIWY4027fWgeQZ 5JLg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:message-id:date:subject:cc:to:from :dkim-signature:dkim-filter; bh=Ywtr357/PxAYIicMt86wE4sG51M8kFX9o9Bks8Pdzrs=; b=ywX4g9dlmUQnKwU3f7P1scOADWDi2vsNdGMjmbni+oHfcgTlCmrHVsfaclDS+1KKfS N6vZ4KMbrlWs2p4T827htL2JSG8y9Rt12Pl9axQkGlkFw9e9YwQpnaTTxU8izVtGGojD 3ijylWWV1irHps9V2myx/7EtaDIohQaCWlEB0QL4ZrgH2IRNvZERxvgvkq4T7vqJ4jm9 A51salSxTfVGmliqMmZT6yoK/Sg3kR4xK2zMSqxS9Z2p3pz25NK57O/5xXuIaOj7ByIk 9/Dtq1IfoaT+adOHpM6RsCcLU8zhuDXkMJZEFyW/8rEGND9wBtKJ83OUsGviFaxi9kYQ NfYg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linux.microsoft.com header.s=default header.b=VofK15xs; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linux.microsoft.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id c11si8681826ejb.541.2020.09.14.21.56.44; Mon, 14 Sep 2020 21:57:07 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@linux.microsoft.com header.s=default header.b=VofK15xs; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linux.microsoft.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726091AbgIOEzy (ORCPT + 99 others); Tue, 15 Sep 2020 00:55:54 -0400 Received: from linux.microsoft.com ([13.77.154.182]:37690 "EHLO linux.microsoft.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726034AbgIOEzw (ORCPT ); Tue, 15 Sep 2020 00:55:52 -0400 Received: from linuxonhyperv3.guj3yctzbm1etfxqx2vob5hsef.xx.internal.cloudapp.net (linux.microsoft.com [13.77.154.182]) by linux.microsoft.com (Postfix) with ESMTPSA id 2B7B7209F325; Mon, 14 Sep 2020 21:55:52 -0700 (PDT) DKIM-Filter: OpenDKIM Filter v2.11.0 linux.microsoft.com 2B7B7209F325 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linux.microsoft.com; s=default; t=1600145752; bh=Ywtr357/PxAYIicMt86wE4sG51M8kFX9o9Bks8Pdzrs=; h=From:To:Cc:Subject:Date:From; b=VofK15xsFToJVZo5nz6jJlrpsg7b23rszIEcSeoFO2rS00tpY2GnZih5fCjD+uKMN tXRMyyFX39KsxqnAf4dgI5gAX6SJZZHIiZKpCeQpF2n5PT+SuOpqejkLCZDhxzdHYn fCd8CveMIecD9tecdRKodcjyq2d/PUCXCShEULFU= From: Vijay Balakrishna To: Andrew Morton , "Kirill A. Shutemov" , Oleg Nesterov , Song Liu , Andrea Arcangeli , Pavel Tatashin , Vijay Balakrishna , Michal Hocko , Allen Pais Cc: linux-kernel@vger.kernel.org, linux-mm@kvack.org Subject: [v1] mm: khugepaged: avoid overriding min_free_kbytes set by user Date: Mon, 14 Sep 2020 21:55:48 -0700 Message-Id: <1600145748-26518-1-git-send-email-vijayb@linux.microsoft.com> X-Mailer: git-send-email 1.8.3.1 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org set_recommended_min_free_kbytes need to honor min_free_kbytes set by the user. Post start-of-day THP enable or memory hotplug operations can lose user specified min_free_kbytes, in particular when it is higher than calculated recommended value. Signed-off-by: Vijay Balakrishna Cc: stable@vger.kernel.org --- mm/khugepaged.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/mm/khugepaged.c b/mm/khugepaged.c index 4f7107476a6f..b4b753ba411a 100644 --- a/mm/khugepaged.c +++ b/mm/khugepaged.c @@ -2253,7 +2253,7 @@ static void set_recommended_min_free_kbytes(void) { struct zone *zone; int nr_zones = 0; - unsigned long recommended_min; + int recommended_min; for_each_populated_zone(zone) { /* @@ -2280,12 +2280,12 @@ static void set_recommended_min_free_kbytes(void) /* don't ever allow to reserve more than 5% of the lowmem */ recommended_min = min(recommended_min, - (unsigned long) nr_free_buffer_pages() / 20); + (int) nr_free_buffer_pages() / 20); recommended_min <<= (PAGE_SHIFT-10); - if (recommended_min > min_free_kbytes) { + if (recommended_min > user_min_free_kbytes) { if (user_min_free_kbytes >= 0) - pr_info("raising min_free_kbytes from %d to %lu to help transparent hugepage allocations\n", + pr_info("raising min_free_kbytes from %d to %d to help transparent hugepage allocations\n", min_free_kbytes, recommended_min); min_free_kbytes = recommended_min; -- 2.28.0