Received: by 2002:a05:7412:3290:b0:fa:6e18:a558 with SMTP id ev16csp502625rdb; Fri, 26 Jan 2024 02:07:27 -0800 (PST) X-Google-Smtp-Source: AGHT+IHme/hDaAL7xF48a6Yw6ups7m0yJ0FZsDpna3umaSyRUjJB6PL+jHkt7PQpWNkhoziV17aE X-Received: by 2002:a17:902:ce89:b0:1d7:91e3:2e61 with SMTP id f9-20020a170902ce8900b001d791e32e61mr1056296plg.1.1706263647534; Fri, 26 Jan 2024 02:07:27 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1706263647; cv=pass; d=google.com; s=arc-20160816; b=sZIrIfIqiuVkinBd6+qDWFSINaA053qKODaGRWNoP+h3V5livhSGsFDR1V1P494yq4 0R8BBAeyHOW3R+B/IVwDMNuhPfa5lkC3jz5pzzp7oPqNOeUuRMWG90P6rbT3ZAIqwXNj IdUjDUHu6VWDRHp+lhkhKV6KqD3tUY8YwhYRqsYa47QiSOJDyhXEp+InoMK7DrPoNIpC C5NEZDUmQAooIkqas9dMBcaVd52nz1NtDNiiiLyK84LY8oA/O6TOuYijbxbkQ54Jq2Jz 8tfaYbS681M8NTdTdhRGDjxZOx62TBXURuAPHJzVFFqvpQu5qZHCo0+1ieh+gzrc54hW 4hqA== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:message-id:date:subject:cc:to :from:dkim-signature; bh=UEiYHt6EA6JI2A3oFzAKFbfq5nte6C1ofdfTW06tbP8=; fh=KPJjYJHLC+uLVMTRQa7GdG2CYCH/otyIF0MYaE50dhE=; b=Qyo/fs4ZIc7C+7e9nkaQy0MXnBGRR2qG3bm0XYtRsnoV5SUmta3T5D+iK+SxyQDGsk gfTrTKftqjk0E6TYwOdpUEOTd256hN4BOasdGztNUxS4qGhyPYBii/4FDkRJGr3MaCHD bV7mo8q8ALwM/oNKf+im6r44Q2dUSXWY81aAffQ5JCpRw4Nk5G+kekiRPQujDT2ctwLE xTBsP+rL6kfzh2THnaLANoJvtAUzFXm/EDp2yFFWegOPmaxPlgl+qHbuB3PK2m0vj67S 00cPQ37gRbuSajxi1LpTDovSEu0mcmjvxs6MNe25XitQmYX4eFRZEv1pZXzH9p62XWex Eo1Q== ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@linux.dev header.s=key1 header.b=hZaTYq6y; arc=pass (i=1 spf=pass spfdomain=linux.dev dkim=pass dkdomain=linux.dev dmarc=pass fromdomain=linux.dev); spf=pass (google.com: domain of linux-kernel+bounces-39865-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-39865-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linux.dev Return-Path: Received: from sv.mirrors.kernel.org (sv.mirrors.kernel.org. [2604:1380:45e3:2400::1]) by mx.google.com with ESMTPS id o10-20020a170903008a00b001d710681b2csi853046pld.150.2024.01.26.02.07.27 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 26 Jan 2024 02:07:27 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-39865-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) client-ip=2604:1380:45e3:2400::1; Authentication-Results: mx.google.com; dkim=pass header.i=@linux.dev header.s=key1 header.b=hZaTYq6y; arc=pass (i=1 spf=pass spfdomain=linux.dev dkim=pass dkdomain=linux.dev dmarc=pass fromdomain=linux.dev); spf=pass (google.com: domain of linux-kernel+bounces-39865-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-39865-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linux.dev Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by sv.mirrors.kernel.org (Postfix) with ESMTPS id 62F7F2955AE for ; Fri, 26 Jan 2024 09:50:12 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 39D5250A8B; Fri, 26 Jan 2024 08:59:26 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linux.dev header.i=@linux.dev header.b="hZaTYq6y" Received: from out-177.mta0.migadu.com (out-177.mta0.migadu.com [91.218.175.177]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id C59C150A83 for ; Fri, 26 Jan 2024 08:59:21 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=91.218.175.177 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1706259564; cv=none; b=VRQvrlpPCdj9MXviaVch/Ry/aXRRpqbktkNIQlKPFeBguuZQ4EiSJ2OJw+gxwhKNu4l57gfLX2XCClZchBkmK6mby2EtXfkJcmuJPVpqSOD2K0ugkQ7y9Ol8GuNYNjRbDwq5h0+kfzsFVR6chSKV542PPPQKbuatypjzFPtLm6s= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1706259564; c=relaxed/simple; bh=836H8CGuHwNWoT8y45F3p7ZGOUU+Or9lzM4KtbucyVI=; h=From:To:Cc:Subject:Date:Message-Id:MIME-Version; b=sShKV55zVqHWYp90qLU3hOTarktDtTC1HVazSczblP+6lL0RPqFRCsXRdBvmT8KvoVF/39VGccGfx2/MsMCvMR/1t1Tq36zPCbrwI4fa8RH6OJG3xziO9lzFEoOcwQpWkMZCNxaEYJuGIuV+NN3fvRH4yFG+qSb0uGjG4quzhvc= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.dev; spf=pass smtp.mailfrom=linux.dev; dkim=pass (1024-bit key) header.d=linux.dev header.i=@linux.dev header.b=hZaTYq6y; arc=none smtp.client-ip=91.218.175.177 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.dev Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=linux.dev X-Report-Abuse: Please report any abuse attempt to abuse@migadu.com and include these headers. DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linux.dev; s=key1; t=1706259559; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding; bh=UEiYHt6EA6JI2A3oFzAKFbfq5nte6C1ofdfTW06tbP8=; b=hZaTYq6yORpyB61XP6FMuKwBdf5riISYuB3djvq9huZIB+zXVjpCYtDIbBToipBg9QPfet CYsKkoucQO52QVjWiED1IvybA9EJBl5Or/kkOqLNp40LRro9eS0hDb+jFjPzQfPdSiwIyM +RiZki+Mn0KsyOk3pt7xvKYoflnmRGE= From: Yajun Deng To: akpm@linux-foundation.org Cc: linux-mm@kvack.org, linux-kernel@vger.kernel.org, Yajun Deng Subject: [PATCH] mm/mmap: use SZ_{8M, 128M} helper macro Date: Fri, 26 Jan 2024 16:59:05 +0800 Message-Id: <20240126085905.2835513-1-yajun.deng@linux.dev> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Migadu-Flow: FLOW_OUT Use SZ_{8M, 128M} macro intead of the number in init_user_reserve and reserve_mem_notifier. Signed-off-by: Yajun Deng --- mm/mmap.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/mm/mmap.c b/mm/mmap.c index 476de5daf598..f90924b2a6d2 100644 --- a/mm/mmap.c +++ b/mm/mmap.c @@ -3845,7 +3845,7 @@ static int init_user_reserve(void) free_kbytes = K(global_zone_page_state(NR_FREE_PAGES)); - sysctl_user_reserve_kbytes = min(free_kbytes / 32, 1UL << 17); + sysctl_user_reserve_kbytes = min(free_kbytes / 32, SZ_128M); return 0; } subsys_initcall(init_user_reserve); @@ -3866,7 +3866,7 @@ static int init_admin_reserve(void) free_kbytes = K(global_zone_page_state(NR_FREE_PAGES)); - sysctl_admin_reserve_kbytes = min(free_kbytes / 32, 1UL << 13); + sysctl_admin_reserve_kbytes = min(free_kbytes / 32, SZ_8M); return 0; } subsys_initcall(init_admin_reserve); @@ -3898,12 +3898,12 @@ static int reserve_mem_notifier(struct notifier_block *nb, case MEM_ONLINE: /* Default max is 128MB. Leave alone if modified by operator. */ tmp = sysctl_user_reserve_kbytes; - if (0 < tmp && tmp < (1UL << 17)) + if (tmp > 0 && tmp < SZ_128M) init_user_reserve(); /* Default max is 8MB. Leave alone if modified by operator. */ tmp = sysctl_admin_reserve_kbytes; - if (0 < tmp && tmp < (1UL << 13)) + if (tmp > 0 && tmp < SZ_8M) init_admin_reserve(); break; -- 2.25.1