From: Dave Hansen <haveblue@us.ibm.com>
To: Gerrit Huizenga <gh@us.ibm.com>
Cc: Linux Kernel Mailing List <linux-kernel@vger.kernel.org>,
Andrew Morton <akpm@osdl.org>, Rik van Riel <riel@redhat.com>,
Chris Mason <mason@suse.com>,
ckrm-tech <ckrm-tech@lists.sourceforge.net>
Subject: Re: [PATCH] CKRM: 8/10 CKRM: Resource controller for prioritizing inbound network requests
Date: Mon, 29 Nov 2004 12:28:58 -0800 [thread overview]
Message-ID: <1101760138.9548.6.camel@localhost> (raw)
In-Reply-To: <E1CYqcL-0005A1-00@w-gerrit.beaverton.ibm.com>
You sure do like C++ comments, don't you :)
On Mon, 2004-11-29 at 10:51, Gerrit Huizenga wrote:
> +#ifdef CONFIG_ACCEPT_QUEUES
> +#define TCP_ACCEPTQ_SHARE 13 /* Set accept queue share */
> +#endif
Why does a #define need an #ifdef? It's not like there's object size
bloat from it.
> +#ifdef CONFIG_ACCEPT_QUEUES
> +
> +#define NUM_ACCEPT_QUEUES 8 /* Must be power of 2 */
> +
> +struct tcp_acceptq_info {
> + unsigned char acceptq_shares;
> + unsigned long acceptq_wait_time;
> + unsigned int acceptq_qcount;
> + unsigned int acceptq_count;
> +};
> +#endif
Same here. Are you just trying to make sure that uses of those
variables don't happen outside of your other #ifdef'd code?
> +struct tcp_listen_opt
> +{
> + u8 max_qlen_log; /* log_2 of maximal queued SYNs */
> + int qlen;
> +#ifdef CONFIG_ACCEPT_QUEUES
> + int qlen_young[NUM_ACCEPT_QUEUES];
> +#else
> + int qlen_young;
> +#endif
> + int clock_hand;
> + u32 hash_rnd;
> + struct open_request *syn_table[TCP_SYNQ_HSIZE];
> +};
Icky. How about just making NUM_ACCEPT_QUEUES=1 when your option is
off? Should all compile down to the same thing.
> + if (prev_class < 0) {
> + req->dl_next = tp->accept_queue;
> + tp->accept_queue = req;
> + }
> + else {
> + req->dl_next = tp->acceptq[prev_class].aq_tail->dl_next;
> + tp->acceptq[prev_class].aq_tail->dl_next = req;
> + }
> + }
Documentation/CodingStyle. else and brakets on one line, please.
> +static void *laq_res_alloc(struct ckrm_core_class *core,
> + struct ckrm_core_class *parent)
> +{
...
> + res = kmalloc(sizeof(ckrm_laq_res_t), GFP_ATOMIC);
> + if (res) {
> + memset(res, 0, sizeof(res));
> + spin_lock_init(&res->reslock);
> + laq_res_hold(res);
> + res->my_depth = pdepth;
> + if (pdepth == 2) // listen class
> + res->my_id = 0;
> + else if (pdepth == 3)
> + res->my_id = atoi(laq_get_name(core));
> + res->core = core;
> + res->pcore = parent;
> +
> + // rescls in place, now initialize contents other than
> + // hierarchy pointers
> + laq_res_initcls(res); // acts as initialising value
> + }
> +
> + return res;
> +}
Generally, these look nicer if you do this:
res = kmalloc()
if (!res)
return res;
...
stuff from old if() here
...
-- Dave
next prev parent reply other threads:[~2004-11-29 20:31 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2004-11-29 18:51 [PATCH] CKRM: 8/10 CKRM: Resource controller for prioritizing inbound network requests Gerrit Huizenga
2004-11-29 20:28 ` Dave Hansen [this message]
2004-11-30 16:40 ` [ckrm-tech] " James Morris
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=1101760138.9548.6.camel@localhost \
--to=haveblue@us.ibm.com \
--cc=akpm@osdl.org \
--cc=ckrm-tech@lists.sourceforge.net \
--cc=gh@us.ibm.com \
--cc=linux-kernel@vger.kernel.org \
--cc=mason@suse.com \
--cc=riel@redhat.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox