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=-5.8 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI, SPF_HELO_NONE,SPF_PASS autolearn=no 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 31DBAC636C9 for ; Thu, 15 Jul 2021 19:06:54 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id 843C7613E5 for ; Thu, 15 Jul 2021 19:06:53 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 843C7613E5 Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=soleen.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=owner-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix) id D92EB8D00F4; Thu, 15 Jul 2021 15:06:53 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id D42E68D00EC; Thu, 15 Jul 2021 15:06:53 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id BE3518D00F4; Thu, 15 Jul 2021 15:06:53 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0148.hostedemail.com [216.40.44.148]) by kanga.kvack.org (Postfix) with ESMTP id 996EE8D00EC for ; Thu, 15 Jul 2021 15:06:53 -0400 (EDT) Received: from smtpin28.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay02.hostedemail.com (Postfix) with ESMTP id 698E1250C7 for ; Thu, 15 Jul 2021 19:06:52 +0000 (UTC) X-FDA: 78365754264.28.5DB89DE Received: from mail-ej1-f46.google.com (mail-ej1-f46.google.com [209.85.218.46]) by imf13.hostedemail.com (Postfix) with ESMTP id 1BDAC1007FA4 for ; Thu, 15 Jul 2021 19:06:51 +0000 (UTC) Received: by mail-ej1-f46.google.com with SMTP id hr1so11081563ejc.1 for ; Thu, 15 Jul 2021 12:06:51 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=soleen.com; s=google; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=uqvGsJK5Zcuxyijq6bYQkFswgt3gMFWId21swertgS0=; b=GnDQiC/frMfCzr26Rp5EJ50FhygKMKaL/9juNBqQ+Hy7v1PhfxDdwxySS0qT2yx5Di /GQQ0Fx0k8c8JsFgPgVFR6QOS21RQtFtUX+bgw96iqmdIwnD4C/uUljPFOYTNv1wz+wl PRWwdFcHgVSuyyhlmk20eieNTe2b2RSSa6tncYx1O0RSXef6B3htdoTxI1JQBycdvxeL xB94G66D6vpE4THo9Sev/88rKsHveH2zCcLX6u04+9A/O3aAtl5uQdyNAiGGJAGGGNqd XDPn7lCQsOMU1Ouv3MM93Har6BEECgWxK1INaH9IuQ25L4Jf9WhUpYYDd00pWxYO2Ouh 9zEQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=uqvGsJK5Zcuxyijq6bYQkFswgt3gMFWId21swertgS0=; b=hLCFuJ0HuiLIFCF9XZPIQeWZopqwIia7F6PCIyPhLjVg4E9YNXm+UfLsQtI7XPmxdZ HTCecapnlFlxoNo8UE2PWSlR/w967pWW0MnzXfVz7c6nXDjf0KQaWZtxVU9GaF7saE71 4Y6izq+ABewU0FtMkGv/+vGtt5y5ayj0R9CvaMtxCyROgRQbA18LFL2ny2fd+1lsNOGi tF1hKwNJW6mj0BThsTodxPB9EqOi8iEcVLj9Hhbx/gsCsiKMZhFlQc26Yq/tPDYOqUdB iUb2+9q2kKW0w4KcLrd5CRWWTjG6awzz16Fc399+mWLerHuIfWecamTuyz28nT2gH0sK CHmg== X-Gm-Message-State: AOAM530sJLKH48Ka4SUK9bCtQLvXrCbZ/3VfQmQfT/Bm1w1huF/d3YY9 oPWpT7PzHgw3E/h+zENX5hJ+gSYnfSKyHfC90FltFw== X-Google-Smtp-Source: ABdhPJwAJtZ056pN3g1I+ukwRrssYAGm4I6BGigJPe34BUO8xjUJ/FyHC7YvTHztWo1Kk1u17Vd4nKVZ58mHFmDU168= X-Received: by 2002:a17:906:31d4:: with SMTP id f20mr6897385ejf.383.1626376010882; Thu, 15 Jul 2021 12:06:50 -0700 (PDT) MIME-Version: 1.0 References: <343394260f599d940cacc37f1dcc0309239ae220.1626371112.git.zhansayabagdaulet@gmail.com> In-Reply-To: From: Pavel Tatashin Date: Thu, 15 Jul 2021 15:06:15 -0400 Message-ID: Subject: Re: [PATCH 1/2] mm: KSM: fix ksm_run data type To: Matthew Wilcox Cc: Zhansaya Bagdauletkyzy , Andrew Morton , Tyler Hicks , linux-mm , LKML Content-Type: text/plain; charset="UTF-8" Authentication-Results: imf13.hostedemail.com; dkim=pass header.d=soleen.com header.s=google header.b="GnDQiC/f"; spf=pass (imf13.hostedemail.com: domain of pasha.tatashin@soleen.com designates 209.85.218.46 as permitted sender) smtp.mailfrom=pasha.tatashin@soleen.com; dmarc=none X-Rspamd-Server: rspam03 X-Rspamd-Queue-Id: 1BDAC1007FA4 X-Stat-Signature: dh19gpre63xu5koyctes8y68ztk7k7y8 X-HE-Tag: 1626376011-873983 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: > > > /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'. > > The offline mode cannot be set externally. > > In run_store() > if (flags > KSM_RUN_UNMERGE) > return -EINVAL; However, I see that KSM_RUN_OFFLINE is visible via run_show(), so yes doc should be updated. And, yes it becomes a bitfield from the user perspective. > > > > > 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. > > Users can only write 0, 1, or 2, it is not a bitmap from the user's > perspective as the user cannot write: '3' . But, I think it is > somewhat weird that ksm_run is used as a bitmap internally with > KSM_RUN_OFFLINE = 4. > > Imo, KSM_RUN_OFFLINE should be placed in a separate boolean from "ksm_run". > > > > > [1] or even 0b, although I see that _parse_integer_fixup_radix does not > > support the 0b notation.