From patchwork Thu Jul 14 16:17:40 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dai Ngo X-Patchwork-Id: 12918182 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 65BB6C433EF for ; Thu, 14 Jul 2022 16:17:50 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S238969AbiGNQRt (ORCPT ); Thu, 14 Jul 2022 12:17:49 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:46288 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S235114AbiGNQRs (ORCPT ); Thu, 14 Jul 2022 12:17:48 -0400 Received: from mx0b-00069f02.pphosted.com (mx0b-00069f02.pphosted.com [205.220.177.32]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id D2BAA61D65 for ; Thu, 14 Jul 2022 09:17:47 -0700 (PDT) Received: from pps.filterd (m0246632.ppops.net [127.0.0.1]) by mx0b-00069f02.pphosted.com (8.17.1.5/8.17.1.5) with ESMTP id 26EFrJ5D000875 for ; Thu, 14 Jul 2022 16:17:47 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oracle.com; h=from : to : cc : subject : date : message-id; s=corp-2021-07-09; bh=SfPxDcrTv8ZKhmlLYAs96i6RDiQQaIhpdZDMIRU8ksg=; b=he9iozDuK6rM2Cr+C28tGxkSSkkfNRwoK7w592WRV/b2+4uIey5LaTK8Jd3fFdfuEwEh Os3Vx1KiIIQYLJpa8uVD4RBs2rr0sTZVwZ+5B+X+udMgKGTXyPYssTEgxx/dX46Q7uW7 zwGGmYcddVuLIJuM+V4qdDQalg0TeU313OlbSv/xwfFxQBath7BY+QH3ZPSZnHuzGDdr dsKS5Z+VhYwsvQYQk//B2EwGfVdSYuPY0VxjlDXMIW6SFcFrJFEcVu/JKvZ6wFOfEdsm 9yNXz1auJhGNykgyuEC/+xKRZOgIUPshcuZLuu5myoOzbv3Rm+lZgTYmapRDEAgLC8ns Kw== Received: from phxpaimrmta02.imrmtpd1.prodappphxaev1.oraclevcn.com (phxpaimrmta02.appoci.oracle.com [147.154.114.232]) by mx0b-00069f02.pphosted.com (PPS) with ESMTPS id 3h71xrnnjc-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK) for ; Thu, 14 Jul 2022 16:17:46 +0000 Received: from pps.filterd (phxpaimrmta02.imrmtpd1.prodappphxaev1.oraclevcn.com [127.0.0.1]) by phxpaimrmta02.imrmtpd1.prodappphxaev1.oraclevcn.com (8.16.1.2/8.16.1.2) with SMTP id 26EGFfMN018977 for ; Thu, 14 Jul 2022 16:17:46 GMT Received: from pps.reinject (localhost [127.0.0.1]) by phxpaimrmta02.imrmtpd1.prodappphxaev1.oraclevcn.com with ESMTP id 3h70467f64-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK) for ; Thu, 14 Jul 2022 16:17:46 +0000 Received: from phxpaimrmta02.imrmtpd1.prodappphxaev1.oraclevcn.com (phxpaimrmta02.imrmtpd1.prodappphxaev1.oraclevcn.com [127.0.0.1]) by pps.reinject (8.16.0.36/8.16.0.36) with SMTP id 26EGHjDo024660 for ; Thu, 14 Jul 2022 16:17:45 GMT Received: from ca-common-hq.us.oracle.com (ca-common-hq.us.oracle.com [10.211.9.209]) by phxpaimrmta02.imrmtpd1.prodappphxaev1.oraclevcn.com with ESMTP id 3h70467f5u-1; Thu, 14 Jul 2022 16:17:45 +0000 From: Dai Ngo To: chuck.lever@oracle.com Cc: linux-nfs@vger.kernel.org Subject: [PATCH v2 0/2] limit the number of v4 clients to 1024 per 1GB of system memory Date: Thu, 14 Jul 2022 09:17:40 -0700 Message-Id: <1657815462-14069-1-git-send-email-dai.ngo@oracle.com> X-Mailer: git-send-email 1.8.3.1 X-Proofpoint-GUID: KPrmx7dviaYI_qI1UwCAlWMf0qMWJbbX X-Proofpoint-ORIG-GUID: KPrmx7dviaYI_qI1UwCAlWMf0qMWJbbX Precedence: bulk List-ID: X-Mailing-List: linux-nfs@vger.kernel.org This patch series enforces a limit on the number of v4 clients allowed in the system. With Courteous server support there are potentially a lots courtesy clients exist in the system that use up memory resource preventing them to be used by other components in the system. Also without a limit on the number of clients, the number of clients can grow to a very large number even for system with small memory configuration eventually render the system into an unusable state. v2: . move all defines to nfsd.h . replace unsigned int nfs4_max_client to int . kick start laundromat in alloc_client when max client reached. . restyle compute of maxreap in nfs4_get_client_reaplist to oneline. . redo enforce of maxreap in nfs4_get_client_reaplist for readability . use bit-wise interger to compute usable memory in nfsd_init_net. . replace NFS4_MAX_CLIENTS_PER_4GB to NFS4_CLIENTS_PER_GB. . use all memory, including high mem, to compute max client. --- Dai Ngo (2): NFSD: keep track of the number of v4 clients in the system NFSD: limit the number of v4 clients to 1024 per 1GB of system memory fs/nfsd/netns.h | 3 +++ fs/nfsd/nfs4state.c | 28 ++++++++++++++++++++-------- fs/nfsd/nfsctl.c | 8 ++++++++ fs/nfsd/nfsd.h | 2 ++ 4 files changed, 33 insertions(+), 8 deletions(-) -- Dai Ngo