From patchwork Thu Mar 30 15:07:57 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Chris Hyser X-Patchwork-Id: 77261 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:b0ea:0:b0:3b6:4342:cba0 with SMTP id b10csp1242796vqo; Thu, 30 Mar 2023 09:13:00 -0700 (PDT) X-Google-Smtp-Source: AKy350adtqy5CGksZC23FELZTmX3n8cEf1az50V6NTZP055aClRRAu8SqXzS9VAFak6/9T5CWPBj X-Received: by 2002:a17:902:e394:b0:1a1:903f:de61 with SMTP id g20-20020a170902e39400b001a1903fde61mr17818330ple.63.1680192779776; Thu, 30 Mar 2023 09:12:59 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1680192779; cv=pass; d=google.com; s=arc-20160816; b=hw/y0YSsRnEiirytU+8cis40Otbte6BztVpQdO19K6cYU8JXwpa0SLKZeil1Y0ymcu 5zywowo0dsaeYenzah63B/a4/jTssaJu+TGOSMT5Lj8VnPRW0+WSFINHsBTMT3QbgKJE NuwAbnm9Hq4y9JOyw9UOwCTGM2JTFwx6cIW1ghZXSqBeWPU6LnQtVSu8H0CBM8BS2jgi ilETYLvCsPxfAK77UXMR2oThcPkkmZXPYd9kaBNppkpl3bI49eB99wXoh1cCJzaGHZDf gxqb1PvwBQl5HAPFyjWXY2vNRM3p8N+11tB26L6Pn12ABHVRGlp6Dcgun4UbVJWMQP8+ G9lw== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:mime-version:content-transfer-encoding :message-id:date:subject:to:from:dkim-signature:dkim-signature; bh=N+U6BntXZJtnUuMShahUhC87lVl2uwOH1z97GS5eZCE=; b=hmn+2JXPyoPc81iReH099XP0R7yPTYAGKAt/KbOZNdv71k0ZA6yMpoR8Vj+TnBVLeU lruRvbpRuZfXx1KL2fhNs4DQQ2ya9I8gc9vxuxFecT8X/2Bsq7NFk+s8KW8tH89qi1/1 cvhQ3xnDLBqssDAPBE37u43yVUgoqEn2bo7CqliAEWIhsALpa4ocvS1XzEFNymPi0I2f /Of9QVwY40c40UbwAUiX5eYB0oivOsxFpl6rpeBgPnw4NH7Bx4CFULP9Elz1TPvk4mKg +aduSFc5wRMXKNcMg43Z/QROue5n8LU85Z2qyEYUEwiPFwkVlepzbkTxCj4Q18kxQG1w wDxw== ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@oracle.com header.s=corp-2022-7-12 header.b=NViJmoUy; dkim=pass header.i=@oracle.onmicrosoft.com header.s=selector2-oracle-onmicrosoft-com header.b=Qg0966it; arc=pass (i=1 spf=pass spfdomain=oracle.com dkim=pass dkdomain=oracle.com dmarc=pass fromdomain=oracle.com); spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=oracle.com Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id kw5-20020a170902f90500b001a199eaf57csi33088003plb.404.2023.03.30.09.12.46; Thu, 30 Mar 2023 09:12:59 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@oracle.com header.s=corp-2022-7-12 header.b=NViJmoUy; dkim=pass header.i=@oracle.onmicrosoft.com header.s=selector2-oracle-onmicrosoft-com header.b=Qg0966it; arc=pass (i=1 spf=pass spfdomain=oracle.com dkim=pass dkdomain=oracle.com dmarc=pass fromdomain=oracle.com); spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=oracle.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232778AbjC3PJH (ORCPT + 99 others); Thu, 30 Mar 2023 11:09:07 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:55430 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232726AbjC3PJC (ORCPT ); Thu, 30 Mar 2023 11:09:02 -0400 Received: from mx0a-00069f02.pphosted.com (mx0a-00069f02.pphosted.com [205.220.165.32]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id EF511CDE5 for ; Thu, 30 Mar 2023 08:08:13 -0700 (PDT) Received: from pps.filterd (m0333521.ppops.net [127.0.0.1]) by mx0b-00069f02.pphosted.com (8.17.1.19/8.17.1.19) with ESMTP id 32UEEd0s021652; Thu, 30 Mar 2023 15:08:03 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oracle.com; h=from : to : subject : date : message-id : content-transfer-encoding : content-type : mime-version; s=corp-2022-7-12; bh=N+U6BntXZJtnUuMShahUhC87lVl2uwOH1z97GS5eZCE=; b=NViJmoUy7tJtVN3p+xHDiWwW35SmgQbfaVNMm2qD22uy9hGVGKQ9JYPEiPh/Ys2AFuia +J11/QJd0iJs0RAasfh+XZomDY/b3Q1/R/pr+gyPr8fTmALuUrUmrvf/+JptR9qLiWnB FGS4NNLoltEBMVWFmTwd/5QASJwahfas+H15ydfEngdjGZvyuUpevcJ6QqSO6pZ85692 GF2s2LtHAP3B6wg3BSoQfL09NaSOZPNLff9qYwMgqidVQE1JgnF8COTobfLeHBgQAIKV xKyJCwTGqeDGpUmwPEchXrJYxmImfkHMOQpIRhJRBEnirYPpcjYqqr5H7Gzo2XsxPuv6 ww== Received: from iadpaimrmta03.imrmtpd1.prodappiadaev1.oraclevcn.com (iadpaimrmta03.appoci.oracle.com [130.35.103.27]) by mx0b-00069f02.pphosted.com (PPS) with ESMTPS id 3pmpc93519-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Thu, 30 Mar 2023 15:08:03 +0000 Received: from pps.filterd (iadpaimrmta03.imrmtpd1.prodappiadaev1.oraclevcn.com [127.0.0.1]) by iadpaimrmta03.imrmtpd1.prodappiadaev1.oraclevcn.com (8.17.1.5/8.17.1.5) with ESMTP id 32UEx1Z1030075; Thu, 30 Mar 2023 15:08:01 GMT Received: from nam12-bn8-obe.outbound.protection.outlook.com (mail-bn8nam12lp2173.outbound.protection.outlook.com [104.47.55.173]) by iadpaimrmta03.imrmtpd1.prodappiadaev1.oraclevcn.com (PPS) with ESMTPS id 3phqdg32kb-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Thu, 30 Mar 2023 15:08:01 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=bqdr8SuEhHrmcvCdSunZ2arCrrJt5Zb7dmP47UbX6bnh+UhP5qtlbVBfbOJlu7fh4U7PypjCwuXjx4Rgqknyu7SbhzERQY3HWzRWjs2GLNDId1+07MKz2qnHI0U+1lKM1DePz2iqivFvKpNaX9ZW3rKRKQwSYPoR+PGe1y+AI+k+F4yvhL9JMzGSBHzV4aNaq4oW+FUmaETB+GPvwvnhyT7lh2HZ9pK2zOybEpYoXSMBdJRZZk4zomR+RBhNgeI0oe/5TbHko0iKJGtIZ6q5ZSycjWGk5g8pKqjwKksSy8qrMKkFNWw8M9BT3v5yhDFkDVyj3NIQ/Q/dnmEksAWitA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=N+U6BntXZJtnUuMShahUhC87lVl2uwOH1z97GS5eZCE=; b=Jqr0b6RWCEf2QT0JF5sI28ckMZsmDenMZdcjwTNudvyA1o8Vpite2RbeEFAmyJj6dEfsW3bDSZAU471kn+mLd2IFHhdzb1n6OlYxmchDx5FMeYZpukZ6YRkXVNSgr+f8euRs4jqEDEo8r+kdtZEM+FzoelmeeG4oi/6G2IyMnPLUn2sCoG2Pq8YffJ7IH70nntEzD98xUnB+RodNavqX+lg390GFCsbKjvEh46Hm9cpAOp2HdQoB5GO1Qf0roodxjbJtaK3hBhlc7B5mj8aB25pRTtDLWIuDgl0nuCvNdfoJciM1JrOknxvgF1YeJwCbWMjp/LYWd029LoWohxwjUQ== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=oracle.com; dmarc=pass action=none header.from=oracle.com; dkim=pass header.d=oracle.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oracle.onmicrosoft.com; s=selector2-oracle-onmicrosoft-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=N+U6BntXZJtnUuMShahUhC87lVl2uwOH1z97GS5eZCE=; b=Qg0966itWDZYJffyLw9k9/OPB+MW1wdghh1qLUIeCvpMPYAxJCq42RwqKpij+fqzokE26DIki5YxywWWTvM6tleCkeAOp928Fr8VmqJYSpd3LzLKV/kbnnZ09w0BNqPy1O9YgJUVu4vDuPAiIxnteqOHWFeITJn7Hwttra29/Is= Received: from CO1PR10MB4705.namprd10.prod.outlook.com (2603:10b6:303:96::11) by SA2PR10MB4732.namprd10.prod.outlook.com (2603:10b6:806:fa::19) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6254.22; Thu, 30 Mar 2023 15:07:59 +0000 Received: from CO1PR10MB4705.namprd10.prod.outlook.com ([fe80::ab8d:2bb:c060:7d73]) by CO1PR10MB4705.namprd10.prod.outlook.com ([fe80::ab8d:2bb:c060:7d73%5]) with mapi id 15.20.6254.022; Thu, 30 Mar 2023 15:07:59 +0000 From: chris hyser To: chris.hyser@oracle.com, linux-kernel@vger.kernel.org, dietmar.eggemann@arm.com, peterz@infradead.org, vincent.guittot@linaro.org, "Chen Yu" Subject: [PATCH v2] sched/numa: Fix divide by zero for sysctl_numa_balancing_scan_size. Date: Thu, 30 Mar 2023 11:07:57 -0400 Message-Id: <20230330150757.547423-1-chris.hyser@oracle.com> X-Mailer: git-send-email 2.31.1 X-ClientProxiedBy: SA1PR03CA0009.namprd03.prod.outlook.com (2603:10b6:806:2d3::20) To CO1PR10MB4705.namprd10.prod.outlook.com (2603:10b6:303:96::11) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: CO1PR10MB4705:EE_|SA2PR10MB4732:EE_ X-MS-Office365-Filtering-Correlation-Id: 46ed7b16-de63-40f8-7b08-08db31308ce7 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: l2r26hwnHUxUknj3G4dR+KCm6dHn+paEG7jlOYJbdvwvSMmFwWgNELZyXH5dEFr2DtCekZXz2QILzIYDwNi/C0aqHMBwLWyH+W1fbrsaBeeyzRVlb4VsMWhO0rUs5tH0hxG5y8aou0p4FN407cRgCyuZ+HOXSvung3GeQdh13amx/aVIgyxBBEfnC77AzZ7URqpqsaxZeYJX7g0PIZvn4wZCWrrrf7t8OKmGkMmpGCRcZ7ldsgJQ16ARlsDcd44n8XzZxD34ot1yWFUdJfVbElrrNRT/ae9f5OEnAuehwPPhBXWdUMnBl4E+zRJoXQAq5nh7/HxdBx0MVhFG8mzHvJ4ng6+Y7Kep3cJi+9zrloF3euadGdd61qgz2PdlR8hfuASL8dersJ1wMiPrW2n1ykm/+8nm7vJbJtc+SKU0hhneleZNoZbFb/xkzZGDt4IIAaHuANDDbkbSEUL371CQ1K1DKWG7IiH7pLWs+YRGPBSoNLC2gfvO/7AoY9g8oFr4OyjGBaEIczmr8vTWUePwOeuZmpfmO8f+4jFew0ju6qUh7/73sJ3qYNhKLY0bAOgB X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:CO1PR10MB4705.namprd10.prod.outlook.com;PTR:;CAT:NONE;SFS:(13230028)(39860400002)(136003)(396003)(346002)(376002)(366004)(451199021)(8676002)(6916009)(66476007)(66556008)(66946007)(86362001)(41300700001)(8936002)(36756003)(2906002)(5660300002)(478600001)(6486002)(83380400001)(6512007)(6506007)(1076003)(26005)(186003)(316002)(2616005)(38100700002);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: IS/GiX2XVNKSkMqBn4fLmiQ95SrBxkufcmAUEo69UuoQkUE13YbNlyzZF+brWYD8v654+lGAc6+QVMVKtU1OCG1fju6hlqngoEQt/7GpesaTY9j8EOr/WVwgNb5FxQ8OxDkgJkAIVoGiu2XDhD0RDIlWv7Uj5rMtFbOpSr7QpFFyoOj6YYHH4emFptF+LdnKB2iva17wQXFce44+bsSlt6+mbu/VbZ//cGb3/gT1VwPJr8n50bMjnIBpZ4jgI0qAcwKRbNqyskyZGVMGptSNdaQTo6ki/914cwDHRcUwS8k32XQb5XirtpEvybxaqI/3b1k2KTK98T1N/hE1ej5GSqGu5zGp7a3tEKegCth60R/P6DAjcyea9lSnNhS68IPRbCGI/CrpobohRhe5/CJXIqgRKStSy2Xryi8flDkbI6juBiuHu/hTCFrhQKtzvuulVDqKLoRbExq0/oCOmSni1vDsSBemE6eGyM0HkBvjZzpYHCdnOfm49sIary6ey4vahewokxW8JZ4F9fzxuQMonHpNGA7LohN1+qbNvelFxLYg2oE1P7WwXxRpWV7Se3kKdGtG9AMHNkeL0z8inlvKfX2O/eA1KHIc2esqTsANKtHw5IOsUGF6xom0Sd36YQUwo/PkeqaYl/6yPG7Ghr3K0+TbmLZ9fvqEd10rZydfiSvqVTpwN2/2tnF9/7S75W1Kj5mnuRucxl5/+VynourbRXK8PQSCWnHsckm9a5hhnJWbY7VpkAqNmWH3tVUYprQ8aFnZDVJ2QUmAFwsiUQ+Jf6JJn7CAatHYJbLDYO9e1UrI18DpUl6/gBBnqTvO4HaOu9NWMOd4J0q1f+RprbF+PucDIweClgo0D9gqYQxLCF+bPtWvGAxAYyCBaCxbVZkkNT0LReu1WdrgGD4c7qOd5e1WpNWAE1U936H0j8FCSLPbbzy8SUgTksbeeIGMMi65nDbnaB3CdF2stRCwrti8oS8os0zPjSXQxVz8zITftFsqh/95mwCEgRTFrfbfMSoM7spmQ1oVdhE/lAQ7DNBVUvr6tiRR+FfGxbsoOShRrl7wVYGHhUz5U2i4Q7ESOg7E4Epg14eaVXalX64CsvrfpjhFU8U/ZunjZRX0ELnUsWXGBfBtZJEeVUC7RxKcNqoGS24LQMeBY4RuU5q4EEEh3lyJgD8MsmpCcMFRvRvEAWxcDpqZnRLUo9yEiIaFpNcrKqLj/yYxw80WyI1Qmy2J5ZSoE6T3O6DFad7EnmshKlEHitv1+b4cEDKcFrj9NMC7feuhCOsvySNzdkMxeAT5yyzubXSQPOV8JK9WbaDroU/kIXGzg1+UhAeDEv2KNp1nFXZAQfybfBc9WuGYTBFqE1O9JEvHEXixpmHgnok+NLERPDh3c30tN7U/x55BtVtCIyLtGYCle29dp0XIhlqE6BAhkOXSbDBT6oFxVnEb7sYn3azesnjQ594SuoZCg+FXjVbynZvawiBtWK6B/X6bVN96wRlYtRrGgwRqxB3P+/jevvLejH7WOBH3F701jR13YJNeya4La5OBEgBMSUa68+ZXeZPhZQNxVVusbjGfBmMPyG5NLKqXblkAVvlZVG9p X-MS-Exchange-AntiSpam-ExternalHop-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-ExternalHop-MessageData-0: BzVU1U2Z3CbzJNCFtkfPqsXhwOllyw3HYsZABp4GhqZAqajDr6WCSzr/6A3/hbXM9OiXdQ/IuEAT2OAU8WL0Zpa5S4/rJ5zrbs2E3QMYIZ6//+QUW15XwUwQcyyEBaXrND856DFBTqDs5y68HtrTDa6HRWjeGGX4GKKdiSv64O3qI8J7/Br/x1J44q3mhoTbEX5su96LwfJQjx9npAsVWxfqJ2nUNdRmZy6FJAbPT1Tij00z9qJUEU7oN9Spstg7HSx1Ui09eWbCc4fKvyotIRTJ+HWbncpNeEaEsdcskgqA1EPeiBhUyl08TycytmbHX+xX9DkRk+NsslG2I5lJyQ3h01lni+QceSdgJWQt7qHGfmvrYzU5KOWz/ozRdX5NaqiGpfs9rAOF1cm8ksn7x08+iTeD7/X0z1HyP9JLILkv5JraIc4+kuIPeQBZohWHq1pk/UIclKzMDMqymEiSS56kDpZkk8J3HdD2VGGsxklo6nKkZ/ubjN3Mp84gQlGCqwIT8IoZDI+55nP+C2baLMDXfqmuggBipsi0rSQXm8P8x1BWh5ri1GFLx++p+gPkL6nRHrH724hGsJfegRFySs4jAoWHG9GUOjD08xsxvMxaGi2WGIj+DmC5nf3bEufqHmtDQJ1nOb+2C/cyhp4iyEY2UP/N/Grp7GWa1GHrUJ4AWDN7NjLyhFKXbE8U6niPK8XmnY/W7eAi5glWGljY9RNgp3FevhLXNGgfO+Np9OxEUYYoFoZXVVzD1dOBQNelHQuqXFVixvn1yyf5yE5g+Le3VTSWTVgOZXYlH/KoHBb8lSJsEJwmMX1dTmxu7nH3Cn1c1+2JHNss3//H/2OuKGhzv2duKttdOUlgDtAIQwPbP4Pd3BRqwiUdGk3tmblK X-OriginatorOrg: oracle.com X-MS-Exchange-CrossTenant-Network-Message-Id: 46ed7b16-de63-40f8-7b08-08db31308ce7 X-MS-Exchange-CrossTenant-AuthSource: CO1PR10MB4705.namprd10.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 30 Mar 2023 15:07:59.6637 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 4e2c6054-71cb-48f1-bd6c-3a9705aca71b X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: Pei9ph2gJT79d9twqe7vKlUGkD4wjno8gF/GynvW/A2ocEzBhQAmKP2yuXS/8zpAWpObkBotENm0aCU5E98AEw== X-MS-Exchange-Transport-CrossTenantHeadersStamped: SA2PR10MB4732 X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.254,Aquarius:18.0.942,Hydra:6.0.573,FMLib:17.11.170.22 definitions=2023-03-30_09,2023-03-30_03,2023-02-09_01 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 adultscore=0 mlxscore=0 malwarescore=0 mlxlogscore=999 phishscore=0 bulkscore=0 spamscore=0 suspectscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2303200000 definitions=main-2303300119 X-Proofpoint-GUID: q7IPPc0BsXEyNqavjxQDe5fAEM7WNRXa X-Proofpoint-ORIG-GUID: q7IPPc0BsXEyNqavjxQDe5fAEM7WNRXa X-Spam-Status: No, score=-0.9 required=5.0 tests=DKIM_SIGNED,DKIM_VALID, DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_LOW,RCVD_IN_MSPIKE_H2, SPF_HELO_NONE,SPF_NONE autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1761721975779747734?= X-GMAIL-MSGID: =?utf-8?q?1761809823817556876?= Commit 6419265899d9 ("sched/fair: Fix division by zero sysctl_numa_balancing_scan_size") prevented a divide by zero by using sysctl mechanisms to return EINVAL for a sysctl_numa_balancing_scan_size value of zero. When moved from a sysctl to a debugfs file, this checking was lost. This patch puts zero checking back in place. Signed-off-by: Chris Hyser --- kernel/sched/debug.c | 52 +++++++++++++++++++++++++++++++++++++++++++- 1 file changed, 51 insertions(+), 1 deletion(-) diff --git a/kernel/sched/debug.c b/kernel/sched/debug.c index 1637b65ba07a..b5fc7e250128 100644 --- a/kernel/sched/debug.c +++ b/kernel/sched/debug.c @@ -278,6 +278,56 @@ static const struct file_operations sched_dynamic_fops = { #endif /* CONFIG_PREEMPT_DYNAMIC */ +#ifdef CONFIG_NUMA_BALANCING + +static ssize_t sched_numa_scan_write(struct file *filp, const char __user *ubuf, + size_t cnt, loff_t *ppos) +{ + int err; + char buf[16]; + unsigned int scan_size; + + if (cnt > 15) + cnt = 15; + + if (copy_from_user(&buf, ubuf, cnt)) + return -EFAULT; + buf[cnt] = '\0'; + + err = kstrtouint(buf, 10, &scan_size); + if (err) + return err; + + if (!scan_size) + return -EINVAL; + + sysctl_numa_balancing_scan_size = scan_size; + + *ppos += cnt; + return cnt; +} + +static int sched_numa_scan_show(struct seq_file *m, void *v) +{ + seq_printf(m, "%d\n", sysctl_numa_balancing_scan_size); + return 0; +} + +static int sched_numa_scan_open(struct inode *inode, struct file *filp) +{ + return single_open(filp, sched_numa_scan_show, NULL); +} + +static const struct file_operations sched_numa_scan_fops = { + .open = sched_numa_scan_open, + .write = sched_numa_scan_write, + .read = seq_read, + .llseek = seq_lseek, + .release = single_release, +}; + +#endif /* CONFIG_NUMA_BALANCING */ + __read_mostly bool sched_debug_verbose; static const struct seq_operations sched_debug_sops; @@ -332,7 +382,7 @@ static __init int sched_init_debug(void) debugfs_create_u32("scan_delay_ms", 0644, numa, &sysctl_numa_balancing_scan_delay); debugfs_create_u32("scan_period_min_ms", 0644, numa, &sysctl_numa_balancing_scan_period_min); debugfs_create_u32("scan_period_max_ms", 0644, numa, &sysctl_numa_balancing_scan_period_max); - debugfs_create_u32("scan_size_mb", 0644, numa, &sysctl_numa_balancing_scan_size); + debugfs_create_file("scan_size_mb", 0644, numa, NULL, &sched_numa_scan_fops); debugfs_create_u32("hot_threshold_ms", 0644, numa, &sysctl_numa_balancing_hot_threshold); #endif