All of lore.kernel.org
 help / color / mirror / Atom feed
From: Zhuohao Bai <wcwfta@gmail.com>
To: steved@redhat.com
Cc: libtirpc-devel@lists.sourceforge.net, linux-nfs@vger.kernel.org,
	tanyuan@tinylab.org, forrestniu@foxmail.com, falcon@tinylab.org,
	zhuohao_bai@foxmail.com
Subject: [PATCH v1 2/2] _rpc_dtablesize: Cleaning up the existing code
Date: Tue, 31 Oct 2023 21:13:10 +0800	[thread overview]
Message-ID: <61483752fe0b46729ae223e928d811924f053a7c.1698751763.git.zhuohao_bai@foxmail.com> (raw)
In-Reply-To: <cover.1698751763.git.zhuohao_bai@foxmail.com>

Some users have already taken steps to address this issue. To prevent
duplication, we need to remove the modified code and modify the rpc_dtablesize
function.

Signed-off-by: Zhuohao Bai <zhuohao_bai@foxmail.com>
---
 src/rpc_dtablesize.c | 4 +++-
 src/svc.c            | 2 --
 2 files changed, 3 insertions(+), 3 deletions(-)

diff --git a/src/rpc_dtablesize.c b/src/rpc_dtablesize.c
index 12f80c1..e88698f 100644
--- a/src/rpc_dtablesize.c
+++ b/src/rpc_dtablesize.c
@@ -41,7 +41,9 @@ _rpc_dtablesize(void)
 	static int size;
 
 	if (size == 0) {
-		size = min(1024, sysconf(_SC_OPEN_MAX));
+		size = sysconf(_SC_OPEN_MAX);
+		if (size > FD_SETSIZE)
+			size = FD_SETSIZE;
 	}
 	return (size);
 }
diff --git a/src/svc.c b/src/svc.c
index 3a8709f..9b932a5 100644
--- a/src/svc.c
+++ b/src/svc.c
@@ -657,8 +657,6 @@ svc_getreqset (readfds)
   assert (readfds != NULL);
 
   setsize = _rpc_dtablesize ();
-  if (setsize > FD_SETSIZE)
-    setsize = FD_SETSIZE;
   maskp = readfds->fds_bits;
   for (sock = 0; sock < setsize; sock += NFDBITS)
     {
-- 
2.25.1


  parent reply	other threads:[~2023-10-31 13:14 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-10-31 13:13 [PATCH v1 0/2] _rpc_dtablesize: decrease to fix excessive memory usage Zhuohao Bai
2023-10-31 13:13 ` [PATCH v1 1/2] _rpc_dtablesize: Decrease the value of size Zhuohao Bai
2023-10-31 13:13 ` Zhuohao Bai [this message]
2024-01-05 16:54 ` [PATCH v1 0/2] _rpc_dtablesize: decrease to fix excessive memory usage Steve Dickson

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=61483752fe0b46729ae223e928d811924f053a7c.1698751763.git.zhuohao_bai@foxmail.com \
    --to=wcwfta@gmail.com \
    --cc=falcon@tinylab.org \
    --cc=forrestniu@foxmail.com \
    --cc=libtirpc-devel@lists.sourceforge.net \
    --cc=linux-nfs@vger.kernel.org \
    --cc=steved@redhat.com \
    --cc=tanyuan@tinylab.org \
    --cc=zhuohao_bai@foxmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.