Received: by 2002:a05:7412:d1aa:b0:fc:a2b0:25d7 with SMTP id ba42csp899319rdb; Tue, 30 Jan 2024 01:48:11 -0800 (PST) X-Google-Smtp-Source: AGHT+IHN4WLcZVTqDDc2Qr71SCpryVK8cs5Vb6YgYx7yy47lmXhMGRNLgyXloSnZ6lL+30asczzx X-Received: by 2002:a17:902:f542:b0:1d7:6301:96e0 with SMTP id h2-20020a170902f54200b001d7630196e0mr8305007plf.8.1706608091040; Tue, 30 Jan 2024 01:48:11 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1706608091; cv=pass; d=google.com; s=arc-20160816; b=cS4pwcbYV+Mc5R03Fkxnu/QlWjJrYsdFl6NzkiMY22lAyyQDarXGfQN+A5g5GGuf5W OxHMxgqkDAtsDJz9hFrf3jc8n+4ht21Sjo9ISShMk2UAmPEtiIGljk2ICiBVAvuXJUx+ 4BeumvA5/xAnbvugXsfM7NnbyYG52WS7SDeZLEkPkWhpxNi/BWexDJTVNjHqnUWSefT/ vW5qDpUlA/ewLnGWkGj4TKfSD3WApOn4rRfIDqfb7KZMw87K5HI3tteF/hzy4Qb8pAn6 adJJpz1gWliDHDD3HOtOq2J/DBrzHNr7/TbFgKEDxIyr9/afBtwK/W5pYgCrqV4bVZ3Q OBGQ== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=in-reply-to:content-disposition:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:references:message-id:subject:cc :to:from:date:dkim-signature; bh=JUrIJzTOZqDa/ika+GUnOukRuQO6tORte8yW2n5gJb0=; fh=iae8W7+YsuOdP40WCytoCMmYg2BD/IEWEocE6dbe21o=; b=HsrvOvFQe5TaM2Ki7z4alZqY12aj1pqRLBlY/GrZ+8PvtlD9KV9ciSopkN8aIxvUvU sWy49VmZ+NFXap1DZr2XlMOg8kR6RH2x/BEkxVQC68T7+VSmrMItiQulq6dYZRTs0u0h fvZGrDg/A9XoD0FxVY/cdaWRYjryUx1DTtvn3YxZxRu9P6bkQXj4oEEkHtscSQyZEgcF ymrY46oh96B6ECB11eUZ9DEH0/GD3J0DBPCYHpC1hhuP7PVIN3tOo76GTBdemF8lR4Tq ZI2NPyQlOibrkRj2U2BVODInzXKolsXSoqbVsFuoVEke+9Aizz+TSl+HaJrB7oA4/oRf VlHg== ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=JoTkEI92; arc=pass (i=1 dkim=pass dkdomain=kernel.org); spf=pass (google.com: domain of linux-kernel+bounces-44214-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:40f1:3f00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-44214-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from sy.mirrors.kernel.org (sy.mirrors.kernel.org. [2604:1380:40f1:3f00::1]) by mx.google.com with ESMTPS id iz17-20020a170902ef9100b001d8b5747fd3si5188861plb.228.2024.01.30.01.48.10 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 30 Jan 2024 01:48:11 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-44214-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:40f1:3f00::1 as permitted sender) client-ip=2604:1380:40f1:3f00::1; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=JoTkEI92; arc=pass (i=1 dkim=pass dkdomain=kernel.org); spf=pass (google.com: domain of linux-kernel+bounces-44214-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:40f1:3f00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-44214-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org 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 sy.mirrors.kernel.org (Postfix) with ESMTPS id 771E7B29DF5 for ; Tue, 30 Jan 2024 09:12:02 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 1FF4B5914F; Tue, 30 Jan 2024 09:11:48 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="JoTkEI92" Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (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 4DD2C58120 for ; Tue, 30 Jan 2024 09:11:46 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1706605907; cv=none; b=Q7+e+27Bir+C75VSxJqUWD/HwbCZ56Pg1BMAuKfHjWfyuidbkwlPOR5+K4mdr6H2YJzod7D4jC/V6cV0dqgKxE4tnWgYuVBZfx4R8fucs1IznLRrhaAZ35Qcw/talJWsVX2FA/8nFFHlhM3v5mOR0TtTRJr2kVn9+0xCvVEg5SY= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1706605907; c=relaxed/simple; bh=iOP2KXEOOGWBsVf+9872GoWmuWoOPq2IE9ros2SOLHE=; h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version: Content-Type:Content-Disposition:In-Reply-To; b=YMkEoyF31YnhsX8NqYRvLlbYI5B7p3cAo81sokBqwXsd4izzk48EaLBOimAebgRW1u5ji52zVW4xaNHhVb7CdnWZknIFKxQCHZEWToD8DysiBpj5NsEpWPyfv9yIUnTVcpxzJy+3idUWG55RqTA1BIOCdLxhdiuPh42MHArjftA= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=JoTkEI92; arc=none smtp.client-ip=10.30.226.201 Received: by smtp.kernel.org (Postfix) with ESMTPSA id 30D23C433C7; Tue, 30 Jan 2024 09:11:44 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1706605906; bh=iOP2KXEOOGWBsVf+9872GoWmuWoOPq2IE9ros2SOLHE=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=JoTkEI92AC+PUmil+8rH12bstaBvvlUN4UWkxg/3o8tOErY6zDfZDWL2COwZ6DnAb o9rt87V+o+nvcsG2z2kqygnJzk96n6dGYIpeQorbyZNi8b4+fLUrfw7P4Hyjb1lzpt eaPRfTUWFsJ7eyj9W3Pkrxm6MeqXpDuMoOZ8D29HYGBFZqnKqe/69k4/J8l+PNq90C SivtCgSMpi5THdeJBNBrQM6m8FD1+Mlm8poYdIDCmwEsInUJccUQcFkSb5yBBA3uBu epDT3+FI1nMpSVBYFH5eB5ME17K2HLFsPKycJkcbI8JtLLsB5FN2dxtCXwGaXJxvdr BRyblMe11WcKg== Date: Tue, 30 Jan 2024 11:11:23 +0200 From: Mike Rapoport To: Yajun Deng Cc: akpm@linux-foundation.org, linux-mm@kvack.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH] mm/mmap: use SZ_{8M, 128M} helper macro Message-ID: References: <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-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20240126085905.2835513-1-yajun.deng@linux.dev> On Fri, Jan 26, 2024 at 04:59:05PM +0800, Yajun Deng wrote: > 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); (1UL << 17) != 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) (1UL << 13) != SZ_8M > init_admin_reserve(); > > break; > -- > 2.25.1 > > -- Sincerely yours, Mike.