Received: by 2002:a05:6902:102b:0:0:0:0 with SMTP id x11csp1382220ybt; Thu, 18 Jun 2020 07:28:26 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwQKifGZpAvXG+ZH2gGbM6ySzvpfJae6cwH9O/TUZOJz/pkxtAcm4BYabmhsJY8+whcigaX X-Received: by 2002:a50:98c1:: with SMTP id j59mr4534155edb.120.1592490506608; Thu, 18 Jun 2020 07:28:26 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1592490506; cv=none; d=google.com; s=arc-20160816; b=vhjVi2fksI9pjI/91+A1zblbfa9z9E+SXPMqPq8395z+WZZTyTVkuUMwxPaGYEqfXV RfO9a1HNzSNHt8KUm1aTzAeRz7eDvux626zCOZyvKka5Ui9yYNknjI0CGtuzIz8KYs+2 sg/QNeGI0NVbEB6UaR/Ys1FLfwLx4va41EWgTQwlkg1VyO5g1RLKKlC4HA1HeL4zo4Uk siXwao+QeXCAbypgIXUujoultBJQRLqQS5PKLCTo7KP5dTiWy/TFwk5ec36wAH26U424 8ON4tL53m3R0ZvB/K0i6zrIicGiC0Uj0hDV+AT37nBHQ+bWVueDiVbIPpccsaVLCbQ10 NdGw== 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 :content-language:in-reply-to:mime-version:user-agent:date :message-id:from:references:cc:to:subject:dkim-signature; bh=KmDh7WFGo8eDXXNvbv3E2VMAocRFdN201dDRse8FZ+Y=; b=VFU4bM0PBQjAKGc/rNDXPvi2485Tw/uUsif5j065mtajNbnRC2J3q35eRjFlROwCY1 FudlWDEvNsGlVQ+QosZx/w08xhovaexYoLkV/i5gFPHVry/HUo/LHGf52Tm/Y5Jhjq13 xp1gbD3WONJXsF89IKjyKLAaPMD2xhrv4yePuUDhAa6FpGDoz59eFq3RmNvg4CSe5xzE ahZlmpDeX/jvYLAsjplLMp97srMZa0svho2yhKXgn2tS4jOWpsc8maHJZkzCj97RWDkX L1KywCdd2gfD8NHpDrksrugUYOxfPR7QtcTPWFect0D/3t669bOZq0CnbUIFiEVmvRAR hVQA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@nitingupta.dev header.s=google header.b=gzA2fpTC; 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 Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id jt19si1766457ejb.389.2020.06.18.07.28.03; Thu, 18 Jun 2020 07:28:26 -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=@nitingupta.dev header.s=google header.b=gzA2fpTC; 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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1729844AbgFROZD (ORCPT + 99 others); Thu, 18 Jun 2020 10:25:03 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:54414 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726988AbgFROZB (ORCPT ); Thu, 18 Jun 2020 10:25:01 -0400 Received: from mail-pf1-x444.google.com (mail-pf1-x444.google.com [IPv6:2607:f8b0:4864:20::444]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 2CEBDC06174E for ; Thu, 18 Jun 2020 07:25:00 -0700 (PDT) Received: by mail-pf1-x444.google.com with SMTP id j12so637098pfn.10 for ; Thu, 18 Jun 2020 07:25:00 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=nitingupta.dev; s=google; h=subject:to:cc:references:from:message-id:date:user-agent :mime-version:in-reply-to:content-language:content-transfer-encoding; bh=KmDh7WFGo8eDXXNvbv3E2VMAocRFdN201dDRse8FZ+Y=; b=gzA2fpTC0SesiwtZyor33GPfMnbM4NWLDMf3on76kw/J2V0qq6i3dU1DlwFqYs7GC0 l0Dxz+U/ageOuVGpHsC2o9Pf97ZKuZcmGwK9/d5mfrvY5urDYazN1n2T1+FD3a5BGcUh spSui7Iz17tRuP0KJkOVyVdDlYsEC0BafwRUhyIIS1KUo4EbkDpvhQPqQD/1y2vXHbzM 2pLXTibDMTN0VFpmDcqVTwyUEBsd05qfjKn9wemfCTQ+vqFnGbCJBkRU9q7b9pTIu8aC OLoZUZwtkXuHxsLQXSRL08hnlzS2wbcXP20P4+yIR5HDjcJo9f1GlpJziKGvMGrecI1I g0bg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:subject:to:cc:references:from:message-id:date :user-agent:mime-version:in-reply-to:content-language :content-transfer-encoding; bh=KmDh7WFGo8eDXXNvbv3E2VMAocRFdN201dDRse8FZ+Y=; b=D35r32wxQbCFKXWCGojirfFsYqFNhj7fMeS8YVWaS2YOaH4p0JQFh5RantvC3wCWxc +05v3cVj+2h90fkuEaLHgjbwp/EvfSLO/AGZfiTfnyKJD/x/dx/D8q7XpR4xyzSo/NQy FiYEEwI/IDE8NpkXNg4A43ZABvRpTfQT9lWBj+saDWZViiCHK972VTb7mHIwLUYU4lK9 O/u8K+Zy7VnYAqVFDUxah48D2yi85veiuBONzmQsTysuXUMudFYBfXvfU9IX+Hfp6xKX gzUdx/+/f0PXDmHpaD2aDxcBpaDbfddrBKwDAlOrI5W4GLtdWjY5Trukr6fbqOjRH5c5 a3Bw== X-Gm-Message-State: AOAM533ilUyJ1NgHG61bGLJEjUvNJWo0HULuO0LgctHlfr9Iy3wbRp/w 2i/EnKE1hPdQ1cSLKZkf59Ti/A== X-Received: by 2002:a65:5c45:: with SMTP id v5mr3587952pgr.281.1592490299680; Thu, 18 Jun 2020 07:24:59 -0700 (PDT) Received: from ngvpn01-160-57.dyn.scz.us.nvidia.com ([2601:646:9302:1050:5536:595e:70b0:cc78]) by smtp.gmail.com with ESMTPSA id i26sm3046553pfo.0.2020.06.18.07.24.57 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Thu, 18 Jun 2020 07:24:58 -0700 (PDT) Subject: Re: [PATCH] mm: Use unsigned types for fragmentation score To: Baoquan He , Nitin Gupta Cc: Andrew Morton , Luis Chamberlain , Kees Cook , Iurii Zaikin , Vlastimil Babka , Joonsoo Kim , open list , "open list:PROC SYSCTL" , "open list:MEMORY MANAGEMENT" References: <20200618010319.13159-1-nigupta@nvidia.com> <20200618134142.GD3346@MiWiFi-R3L-srv> From: Nitin Gupta Message-ID: Date: Thu, 18 Jun 2020 07:24:57 -0700 User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.15; rv:68.0) Gecko/20100101 Thunderbird/68.9.0 MIME-Version: 1.0 In-Reply-To: <20200618134142.GD3346@MiWiFi-R3L-srv> Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 6/18/20 6:41 AM, Baoquan He wrote: > On 06/17/20 at 06:03pm, Nitin Gupta wrote: >> Proactive compaction uses per-node/zone "fragmentation score" which >> is always in range [0, 100], so use unsigned type of these scores >> as well as for related constants. >> >> Signed-off-by: Nitin Gupta >> --- >> include/linux/compaction.h | 4 ++-- >> kernel/sysctl.c | 2 +- >> mm/compaction.c | 18 +++++++++--------- >> mm/vmstat.c | 2 +- >> 4 files changed, 13 insertions(+), 13 deletions(-) >> >> diff --git a/include/linux/compaction.h b/include/linux/compaction.h >> index 7a242d46454e..25a521d299c1 100644 >> --- a/include/linux/compaction.h >> +++ b/include/linux/compaction.h >> @@ -85,13 +85,13 @@ static inline unsigned long compact_gap(unsigned int order) >> >> #ifdef CONFIG_COMPACTION >> extern int sysctl_compact_memory; >> -extern int sysctl_compaction_proactiveness; >> +extern unsigned int sysctl_compaction_proactiveness; >> extern int sysctl_compaction_handler(struct ctl_table *table, int write, >> void *buffer, size_t *length, loff_t *ppos); >> extern int sysctl_extfrag_threshold; >> extern int sysctl_compact_unevictable_allowed; >> >> -extern int extfrag_for_order(struct zone *zone, unsigned int order); >> +extern unsigned int extfrag_for_order(struct zone *zone, unsigned int order); >> extern int fragmentation_index(struct zone *zone, unsigned int order); >> extern enum compact_result try_to_compact_pages(gfp_t gfp_mask, >> unsigned int order, unsigned int alloc_flags, >> diff --git a/kernel/sysctl.c b/kernel/sysctl.c >> index 58b0a59c9769..40180cdde486 100644 >> --- a/kernel/sysctl.c >> +++ b/kernel/sysctl.c >> @@ -2833,7 +2833,7 @@ static struct ctl_table vm_table[] = { >> { >> .procname = "compaction_proactiveness", >> .data = &sysctl_compaction_proactiveness, >> - .maxlen = sizeof(int), >> + .maxlen = sizeof(sysctl_compaction_proactiveness), > > Patch looks good to me. Wondering why not using 'unsigned int' here, > just curious. > It's just coding style preference. I see the same style used for many other sysctls too (min_free_kbytes etc.). Thanks, Nitin