Received: by 2002:a05:6a10:1287:0:0:0:0 with SMTP id d7csp614229pxv; Thu, 15 Jul 2021 11:33:40 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwOF9KaY+XY/6HcsOMGDenKcIFYlTzNzd/NOCbe1Mis5+MYtKnnmZvAlEvXjira2r6zocWt X-Received: by 2002:a05:6602:2204:: with SMTP id n4mr4186229ion.181.1626374020004; Thu, 15 Jul 2021 11:33:40 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1626374019; cv=none; d=google.com; s=arc-20160816; b=ipsRm48hXNFxmodU6fQDdDbGibY09R+OcSTpYTtqaGbAXrfaac6SCwAaGs053k4vPM 1Tya+o8G+WVkh3XQavPaCjM/78XV51XQz86dLJrYAGuC97rG0iNNgkO9X6tK7rPFf3Ro g7YE/xSnGUD3lTOEmEAqd4jliFzTrvxwuqOhUAbvX6zEUPPsBEypE0hKv81v0/SRwCbt V2vYPPKnwPwGO0e/7P94bIT9N2S+L2OjMlN3rfMGv9fY82IiBnLO7k6u4p501DFlJbAc CxHQp1awmDQfsUAcYeYAqNQ5dAMAvQ4nHF2Ob1MsKSZS3T+wfeZPCtUXuNmnmMQh3k4Z 7qsg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-disposition:mime-version :references:message-id:subject:cc:to:from:date:dkim-signature; bh=XvBzUI9q5SdUC3+GLbvDvcpwu2AP6zcoqrSLGMfDoLI=; b=PoZ6WoSURzildjEpKP/mu3BC8VYi1XtvvgdYvy+4T02hl5KlplVbq1qNzerg63sjEY AQemb+78vvCBMusxvv5QgIb15/M/0RbF17SnNAdFhL0N7FCOKELAJJbnM5V4CUFYjMGA ijhUmujTAlbQZDejJ+OHSYHS6M1KTxCinTLLW6H9Kiw6fEbgow9bo/YQveyyVCJpuacM GHLkLJcpvwuZFSLgxitYItn1bftP1R9KyAc1l/yyBefIHJy2IrQgTvmaMg2XPmIMnoFH SXt0NN6QkjvibKte5FFEYd1fxDxHZbxGdigcIKqu2kIvxXQ9vqQN5u/FbGOgFNHE532G uA5Q== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@infradead.org header.s=casper.20170209 header.b=uVS6Kcrc; 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 u15si8498540iot.89.2021.07.15.11.33.28; Thu, 15 Jul 2021 11:33:39 -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=@infradead.org header.s=casper.20170209 header.b=uVS6Kcrc; 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 S229897AbhGOSeD (ORCPT + 99 others); Thu, 15 Jul 2021 14:34:03 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:52998 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229506AbhGOSeC (ORCPT ); Thu, 15 Jul 2021 14:34:02 -0400 Received: from casper.infradead.org (casper.infradead.org [IPv6:2001:8b0:10b:1236::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 2AC66C06175F for ; Thu, 15 Jul 2021 11:31:09 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=casper.20170209; h=In-Reply-To:Content-Type:MIME-Version: References:Message-ID:Subject:Cc:To:From:Date:Sender:Reply-To: Content-Transfer-Encoding:Content-ID:Content-Description; bh=XvBzUI9q5SdUC3+GLbvDvcpwu2AP6zcoqrSLGMfDoLI=; b=uVS6KcrcP2Nm6Xm5ddznkWpNYD sCl1YHNrGVdCgmrch/GVkS2KC9g1EGo+PefYChH9voczBALZ95f3GIPzpYZDzDh0R41jS7xNr7mp6 kE7uu11faElqZwBarl5ydMQNqEGLyv/vocuOdVIEmQ3+2Un5p4hgtMULaqNTSNfU4HbLaaKjjgkWY olIZ4f8Jd6LOswjrxQpyr03aWgpi1fpLVP+WhWniqQVClRNj/3GxLjLgNaHsw5R/Rl41xjGKWE+Mr yRmnTeyEpDKydjKwkUfltA5VqXjP2p6OPY6s9msd4OsIXJmeMDysBJluKcLEV+LGIBBUnMiq9USWK y4MCN4Cg==; Received: from willy by casper.infradead.org with local (Exim 4.94.2 #2 (Red Hat Linux)) id 1m467h-003d0R-9x; Thu, 15 Jul 2021 18:30:22 +0000 Date: Thu, 15 Jul 2021 19:30:13 +0100 From: Matthew Wilcox To: Pavel Tatashin Cc: Zhansaya Bagdauletkyzy , Andrew Morton , Tyler Hicks , linux-mm , LKML Subject: Re: [PATCH 1/2] mm: KSM: fix ksm_run data type Message-ID: References: <343394260f599d940cacc37f1dcc0309239ae220.1626371112.git.zhansayabagdaulet@gmail.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Thu, Jul 15, 2021 at 02:21:21PM -0400, Pavel Tatashin wrote: > On Thu, Jul 15, 2021 at 2:18 PM Matthew Wilcox wrote: > > > > On Fri, Jul 16, 2021 at 12:01:01AM +0600, Zhansaya Bagdauletkyzy wrote: > > > +++ b/mm/ksm.c > > > @@ -289,7 +289,7 @@ static int ksm_nr_node_ids = 1; > > > #define KSM_RUN_MERGE 1 > > > #define KSM_RUN_UNMERGE 2 > > > #define KSM_RUN_OFFLINE 4 > > > -static unsigned long ksm_run = KSM_RUN_STOP; > > > +static unsigned int ksm_run = KSM_RUN_STOP; > > > > Should this be an enum instead? > > I think "unsigned int" is OK here, as it is exposed as uint to users: > Documentation/ABI/testing/sysfs-kernel-mm-ksm > > /sys/kernel/mm/ksm/run > > run: write 0 to disable ksm, read 0 while ksm is disabled. > > - write 1 to run ksm, read 1 while ksm is running. > - write 2 to disable ksm and unmerge all its pages. The document is out of date then as it does not mention 'offline'. Also, why does the call to kstrtouint() specify base 10? If it is a bitmap, then permitting 0x [1] is more natural. I would expect to see base 0 there. [1] or even 0b, although I see that _parse_integer_fixup_radix does not support the 0b notation.