From: Linux Geek <linux-geek@hornyaksys.com>
To: root@chaos.analogic.com
Cc: linux-kernel@vger.kernel.org
Subject: Re: Question about copy_from/copy_to
Date: Wed, 27 Nov 2002 16:13:05 -0500 [thread overview]
Message-ID: <3DE53561.7020001@hornyaksys.com> (raw)
In-Reply-To: Pine.LNX.3.95.1021127154031.4051A-100000@chaos.analogic.com
Richard,
Thanks fpr your response,
Yup, it's "political" this project is "work for hire" for an internal
system - the code will never be distributed - all very hush hush. (I
signed a non-disclosure agreement - so I can't be too specific.)
In essence, memory is allocated for each minor device number (total
number of minors and the values are unknown at init time), and the data
stored in a linked list. So for each open, the list is searched, and if
the minor number is found, that is what is used (and a counter
incremented), otherwise memory is allocated ad added to the list. (BTW -
this is not my design and they're paying the bill.)
On the close the memory counter is decremented for the minor, and if
zero, the memory is deallocated, So, it sounds like this is OK,
Richard B. Johnson wrote:
>...
> So, I would say that it's not a good idea to allocate memory during
> an open(). If you some political reason, you are forced to do this,
> you need to count the number of open/close operations and only
> deallocate memory after the final close. There are atomic-counter
> macros you can use for this.
>
> Cheers,
> Dick Johnson
> Penguin : Linux version 2.4.18 on an i686 machine (797.90 BogoMips).
> Bush : The Fourth Reich of America
>
>
prev parent reply other threads:[~2002-11-27 21:07 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2002-11-27 20:26 Question about copy_from/copy_to Linux Geek
2002-11-27 20:52 ` Richard B. Johnson
2002-11-27 21:13 ` Linux Geek [this message]
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=3DE53561.7020001@hornyaksys.com \
--to=linux-geek@hornyaksys.com \
--cc=linux-kernel@vger.kernel.org \
--cc=root@chaos.analogic.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.