From patchwork Thu Jul 15 18:01:01 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Zhansaya Bagdauletkyzy X-Patchwork-Id: 12380659 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=-12.8 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,FREEMAIL_FORGED_FROMDOMAIN,FREEMAIL_FROM, HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER,INCLUDES_PATCH, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS 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 9D816C636C7 for ; Thu, 15 Jul 2021 18:01:06 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id 357BF61289 for ; Thu, 15 Jul 2021 18:01:06 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 357BF61289 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=gmail.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=owner-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix) id 81D188D00EA; Thu, 15 Jul 2021 14:01:06 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 7CDC36B00F2; Thu, 15 Jul 2021 14:01:06 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 66DD68D00EA; Thu, 15 Jul 2021 14:01:06 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0071.hostedemail.com [216.40.44.71]) by kanga.kvack.org (Postfix) with ESMTP id 461D06B00EF for ; Thu, 15 Jul 2021 14:01:06 -0400 (EDT) Received: from smtpin34.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay04.hostedemail.com (Postfix) with ESMTP id 27D2E18097 for ; Thu, 15 Jul 2021 18:01:05 +0000 (UTC) X-FDA: 78365588490.34.2E578AB Received: from mail-lj1-f174.google.com (mail-lj1-f174.google.com [209.85.208.174]) by imf20.hostedemail.com (Postfix) with ESMTP id E462ED0000B9 for ; Thu, 15 Jul 2021 18:01:04 +0000 (UTC) Received: by mail-lj1-f174.google.com with SMTP id x19so1356475ljc.4 for ; Thu, 15 Jul 2021 11:01:04 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=date:from:to:cc:subject:message-id:references:mime-version :content-disposition:in-reply-to; bh=Juo3AM+b40dS1hlfCODzT9PCdvoocT9eJfDW+eUcng8=; b=XwEA5JR850+TGWCt6vJfhkjleSiwtQZzAqAkkd/ng64jUPk6N10XXFblaVpnhTkRY6 Vp3gHpAYGpjMuDDtFclHkmA8Lh4y7UMzJLof9RsM1a5syeWOzv3+v6uF32na48RTKEwT LIldxzV4RPbj9aIDeVuke1TIFzu25vg01kF7acjcZm0NXuLs4MlcQlRHKBhykj2k4RfU yNpSJGFgURlj/5skQIisfQs2w24QtOWyXvq7m8kz6774oCJ3scRlI02LNLQixcS69yjN e6WlnQotTb/gZAqBS9USBUF4Rlp+95RNCZb4xlDMDLZbTCZ3348RfmiHLELt9RyMl73X ov4w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:in-reply-to; bh=Juo3AM+b40dS1hlfCODzT9PCdvoocT9eJfDW+eUcng8=; b=gjC6YZbQtRbayoh3L4GdCkhnxqAJ2tgm1EQG85x6yCef39CHvZRdUk5O/wFYgOAwWy HnqNdRBe7PT1oFRoE6lZja2JGCFmvMo46ta59NpoW7X1R8AnNKbZrU3BK5g6K2g4LeEQ dEBdFG2niC0hVFogIE7I80zsrH7ZgeeQFoxZzErB7tnabsHgbdYh0cNBb2YKpbUpDgqI lQxCHVCL9czChZqN4Rx0GhDC/Vtz/+/+B2R9iOUb/IyFHtGf5iTPNESGmRWnfv6ilRsz /DMiNpOY2bNbiym934FF7NXIiuY7fR2P7tkSGWOuLgkv3FI0mYhAAfU2AxdKE671kEck +8sQ== X-Gm-Message-State: AOAM531wiJpFdWKs3CT8RMYagK+IR8rBftdXfpVUTrRItOraIyzneLgC EyvfFq/Ek88825WC8valuDQ= X-Google-Smtp-Source: ABdhPJwuiTKtNZkDuhZjUUNbAr6X37vDGYkYk/ZXWGJBYgBX33LWROANBmsf54sPkcLD8batIYicOQ== X-Received: by 2002:a2e:950:: with SMTP id 77mr5203883ljj.438.1626372063632; Thu, 15 Jul 2021 11:01:03 -0700 (PDT) Received: from asus ([37.151.208.206]) by smtp.gmail.com with ESMTPSA id b14sm461804lfb.149.2021.07.15.11.01.02 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 15 Jul 2021 11:01:03 -0700 (PDT) Date: Fri, 16 Jul 2021 00:01:01 +0600 From: Zhansaya Bagdauletkyzy To: akpm@linux-foundation.org Cc: tyhicks@linux.microsoft.com, pasha.tatashin@soleen.com, linux-mm@kvack.org, linux-kernel@vger.kernel.org Subject: [PATCH 1/2] mm: KSM: fix ksm_run data type Message-ID: <343394260f599d940cacc37f1dcc0309239ae220.1626371112.git.zhansayabagdaulet@gmail.com> References: MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: Authentication-Results: imf20.hostedemail.com; dkim=pass header.d=gmail.com header.s=20161025 header.b=XwEA5JR8; spf=pass (imf20.hostedemail.com: domain of zhansayabagdaulet@gmail.com designates 209.85.208.174 as permitted sender) smtp.mailfrom=zhansayabagdaulet@gmail.com; dmarc=pass (policy=none) header.from=gmail.com X-Rspamd-Server: rspam02 X-Stat-Signature: zg59s1c599nwczz8g41whorgck5q4q5u X-Rspamd-Queue-Id: E462ED0000B9 X-HE-Tag: 1626372064-671004 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: ksm_run is declared as unsigned long but in run_store(), it is converted to unsigned int. Change its type to unsigned int. Signed-off-by: Zhansaya Bagdauletkyzy Reviewed-by: Pavel Tatashin --- mm/ksm.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/mm/ksm.c b/mm/ksm.c index 3fa9bc8a67cf..057d0c245bf4 100644 --- a/mm/ksm.c +++ 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; static void wait_while_offlining(void); static DECLARE_WAIT_QUEUE_HEAD(ksm_thread_wait); @@ -2874,7 +2874,7 @@ KSM_ATTR(pages_to_scan); static ssize_t run_show(struct kobject *kobj, struct kobj_attribute *attr, char *buf) { - return sysfs_emit(buf, "%lu\n", ksm_run); + return sysfs_emit(buf, "%u\n", ksm_run); } static ssize_t run_store(struct kobject *kobj, struct kobj_attribute *attr, From patchwork Thu Jul 15 18:01:03 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Zhansaya Bagdauletkyzy X-Patchwork-Id: 12380663 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=-12.8 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,FREEMAIL_FORGED_FROMDOMAIN,FREEMAIL_FROM, HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER,INCLUDES_PATCH, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS autolearn=unavailable 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 19F25C636C7 for ; Thu, 15 Jul 2021 18:02:09 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id B610161289 for ; Thu, 15 Jul 2021 18:02:08 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org B610161289 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=gmail.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=owner-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix) id 1DA8B8D00EE; Thu, 15 Jul 2021 14:02:09 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 18B428D00EC; Thu, 15 Jul 2021 14:02:09 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 02BE68D00EE; Thu, 15 Jul 2021 14:02:08 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0024.hostedemail.com [216.40.44.24]) by kanga.kvack.org (Postfix) with ESMTP id D4BEA8D00EC for ; Thu, 15 Jul 2021 14:02:08 -0400 (EDT) Received: from smtpin27.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay03.hostedemail.com (Postfix) with ESMTP id C0BD6824556B for ; Thu, 15 Jul 2021 18:02:07 +0000 (UTC) X-FDA: 78365591094.27.3CE50BE Received: from mail-lj1-f177.google.com (mail-lj1-f177.google.com [209.85.208.177]) by imf05.hostedemail.com (Postfix) with ESMTP id 6A2D75012911 for ; Thu, 15 Jul 2021 18:01:07 +0000 (UTC) Received: by mail-lj1-f177.google.com with SMTP id u14so10222187ljh.0 for ; Thu, 15 Jul 2021 11:01:07 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=date:from:to:cc:subject:message-id:references:mime-version :content-disposition:in-reply-to; bh=2d9p90AIyYXuZyz8N1X+igPtEqtQ6xFMtj7iBan61/4=; b=DG7GKyt4XSoEmdsNZbS2IReKQaI3T7Q+Co+VBceo4tACNkMJfUaeYqnuxt3bN1fnXj GZohmTB12gTVjMurUepDi5ro5Qu1uQkqXHiScBoCVS8xWKdXNmPdoae4v7aN1/NHiowV MJtcwIVJ4dbdleqfXwxAca/OZnHXfp/C5T/OgyikiLs6H1Zr7Jsbo8IxT8msrdozjb+c fByH4YGIejRqn7Tb4gXsisqfZUNMxQcqxxisbxt7TbEzdZLYBySk0X6+X3YixXgSSHQE Iq69f7+cLBQqJ8yvzByhikPJjkCC01ycMNR5WreQuy3LH4+RK/nwLv0RYh8QXdoP0MX6 UTRQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:in-reply-to; bh=2d9p90AIyYXuZyz8N1X+igPtEqtQ6xFMtj7iBan61/4=; b=LNPayq+xoG/eHu7IRPREmT5ePJcUt18P23Jngvyg9WJzkKHtejDrLSh+1jTfU/HNkW yy4Flyre+PHhbQn7wY33rQE0/jvEm5CgVLbqAfle8mAG6Tpxh+ZpoWfsV74L+OBj/qcG rraTPdKHUD/OGOzJ/BlFoB1R5MUvR3wUsDUlW118u5LsApADSxYk+fp5BlvYkMcHL+2Z hXWWcCQReTmidHluEC1eHtuOwQsOv8fYjFQ0G5i1ax79LCwJPzkyCV1sUjTfwc7WxpYM A2QGpfyNItvpv8iD7EUvQQtksQXwNZqBKDn0BmIT0oPwj47DrpkLOKgIhuEAx+4sXxSx DQvQ== X-Gm-Message-State: AOAM530kMG7jKqpjjbEwmwZX0DrwVlQuoxwRkwExQq/nVPcE2ky1Za9c EaoBbfYL288WjMiGWhRhfmSMvarPy1cUJQ== X-Google-Smtp-Source: ABdhPJz/T4eD4gvnZIxPn+tGbMZHDPbGOCEpm5Q+cGIfzkZX/+OASMlP53bWa1D5JtfFgWhs6RYlJg== X-Received: by 2002:a2e:a712:: with SMTP id s18mr5245619lje.161.1626372066140; Thu, 15 Jul 2021 11:01:06 -0700 (PDT) Received: from asus ([37.151.208.206]) by smtp.gmail.com with ESMTPSA id r3sm497511lfc.280.2021.07.15.11.01.05 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 15 Jul 2021 11:01:05 -0700 (PDT) Date: Fri, 16 Jul 2021 00:01:03 +0600 From: Zhansaya Bagdauletkyzy To: akpm@linux-foundation.org Cc: tyhicks@linux.microsoft.com, pasha.tatashin@soleen.com, linux-mm@kvack.org, linux-kernel@vger.kernel.org Subject: [PATCH 2/2] mm: KSM: fix data type Message-ID: <3610f5373bb12ea04e025bafbf8350f75c0dbf4b.1626371112.git.zhansayabagdaulet@gmail.com> References: MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: X-Rspamd-Server: rspam06 X-Rspamd-Queue-Id: 6A2D75012911 X-Stat-Signature: 4kypabunyyikuw7skfg51twok6g8jw7d Authentication-Results: imf05.hostedemail.com; dkim=pass header.d=gmail.com header.s=20161025 header.b=DG7GKyt4; spf=pass (imf05.hostedemail.com: domain of zhansayabagdaulet@gmail.com designates 209.85.208.177 as permitted sender) smtp.mailfrom=zhansayabagdaulet@gmail.com; dmarc=pass (policy=none) header.from=gmail.com X-HE-Tag: 1626372067-446060 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: ksm_stable_node_chains_prune_millisecs is declared as int, but in stable__node_chains_prune_millisecs_store(), it can store values up to UINT_MAX. Change the variable type to unsigned int. Signed-off-by: Zhansaya Bagdauletkyzy Reviewed-by: Pavel Tatashin --- mm/ksm.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/mm/ksm.c b/mm/ksm.c index 057d0c245bf4..2e4bd7662e52 100644 --- a/mm/ksm.c +++ b/mm/ksm.c @@ -259,7 +259,7 @@ static unsigned long ksm_stable_node_chains; static unsigned long ksm_stable_node_dups; /* Delay in pruning stale stable_node_dups in the stable_node_chains */ -static int ksm_stable_node_chains_prune_millisecs = 2000; +static unsigned int ksm_stable_node_chains_prune_millisecs = 2000; /* Maximum number of page slots sharing a stable node */ static int ksm_max_page_sharing = 256; @@ -3105,11 +3105,11 @@ stable_node_chains_prune_millisecs_store(struct kobject *kobj, struct kobj_attribute *attr, const char *buf, size_t count) { - unsigned long msecs; + unsigned int msecs; int err; - err = kstrtoul(buf, 10, &msecs); - if (err || msecs > UINT_MAX) + err = kstrtouint(buf, 10, &msecs); + if (err) return -EINVAL; ksm_stable_node_chains_prune_millisecs = msecs;