From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-8.3 required=3.0 tests=DKIM_SIGNED,DKIM_VALID, DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_PATCH,MAILING_LIST_MULTI, SIGNED_OFF_BY,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED,USER_AGENT_SANE_1 autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 4E7BBC433E0 for ; Thu, 18 Jun 2020 14:25:03 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id 0FC02207E8 for ; Thu, 18 Jun 2020 14:25:02 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=nitingupta.dev header.i=@nitingupta.dev header.b="gzA2fpTC" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 0FC02207E8 Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=nitingupta.dev Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=owner-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix) id 916AE8D0016; Thu, 18 Jun 2020 10:25:02 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 8EDB38D0012; Thu, 18 Jun 2020 10:25:02 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 8043E8D0016; Thu, 18 Jun 2020 10:25:02 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0101.hostedemail.com [216.40.44.101]) by kanga.kvack.org (Postfix) with ESMTP id 666C58D0012 for ; Thu, 18 Jun 2020 10:25:02 -0400 (EDT) Received: from smtpin24.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay05.hostedemail.com (Postfix) with ESMTP id CE5F7181AC9CB for ; Thu, 18 Jun 2020 14:25:01 +0000 (UTC) X-FDA: 76942554402.24.ring72_391231526e11 Received: from filter.hostedemail.com (10.5.16.251.rfc1918.com [10.5.16.251]) by smtpin24.hostedemail.com (Postfix) with ESMTP id A3B6E1DFB for ; Thu, 18 Jun 2020 14:25:01 +0000 (UTC) X-HE-Tag: ring72_391231526e11 X-Filterd-Recvd-Size: 5776 Received: from mail-pg1-f193.google.com (mail-pg1-f193.google.com [209.85.215.193]) by imf42.hostedemail.com (Postfix) with ESMTP for ; Thu, 18 Jun 2020 14:25:01 +0000 (UTC) Received: by mail-pg1-f193.google.com with SMTP id b5so2975038pgm.8 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=X1zWMYyxUVNTwhLDHIaxXc+UejT0L6RhiThmxvl5VXiVvyWidjP+Z5HtBbzLjuQhnh Gx0C1lRofDxmT83wTZ4N58OUzZY86eB8Bnqp8n5NoZwJ5Nw1NdlWXynC+/15TkB9tmqU KYl4gltMjYapqKl4AuZTTPjZI8NVFiBP4oarhYCFGIXGEezgDG8L7SdJH7cfsZmptbZy UMNCJYf6nZfM+0TWbKl/LhjsZcQosqNwYAGSxX6X3xLn8VLGoLdv3A272qMd1Ih3Tt1s a9h+MVXNtbQCbWjEf2PI9XlkWzXZtbGhJyDH6mf2iW5LF/GftXCgb4fiT4EhbOEH9X/S 98gQ== X-Gm-Message-State: AOAM532PEA0Nxnb5nHws14l2YBsoGsNWhfKpzoL6Eij/zs/hUxq8XijO H6x6MCP9400LIY1+3aC6bbwbZjSsF7ISXg== X-Google-Smtp-Source: ABdhPJzYcdMYYIIDStWXFb9/ybpnI+0+TvK2l0kB7vneujNkEsj61fZGyysLeBP0YtPyBWG7vxc8tQ== 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 X-Rspamd-Queue-Id: A3B6E1DFB X-Spamd-Result: default: False [0.00 / 100.00] X-Rspamd-Server: rspam04 X-Bogosity: Ham, tests=bogofilter, spamicity=0.000000, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: 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