From: jamal <hadi@cyberus.ca>
To: David Miller <davem@davemloft.net>
Cc: netdev@vger.kernel.org
Subject: Re: [PATCH][XFRM] export SAD info
Date: Fri, 27 Apr 2007 10:21:45 -0400 [thread overview]
Message-ID: <1177683705.4059.29.camel@localhost> (raw)
In-Reply-To: <20070426.141847.10298516.davem@davemloft.net>
On Thu, 2007-26-04 at 14:18 -0700, David Miller wrote:
> I wouldn't mind if it actually helped anything.
>
> The SMP cache line transactions are more expensive than the
> execution of the code blocks they are protecting. rwlock's
> rarely help, and when they do (the execution path is more
> expensive than the SMP atomic operations) then you're holding
> the lock too long :-)
>
Ok ;->
So if i was to make any change, it would be for consistency
with SPD. If this is sufficiently compelling i will send a patch.
> I would prefer a dynamic algorithm that reacts to system memory
> pressure and yet-another-knob that people will get wrong and
> there is no sane default for.
>
This would certainly be a better approach if doable.
> I plan to do away with all the GC threshold madness in the
> routing cache, for example, and just let the MM layer call
> back into us when there is memory pressure to trigger GC.
>
> See set_shrinker() and friends. The MM calls into these
> handlers in response to memory pressure. There is no
> reason the networking can't hook into this and do things
> properly instead of the ad-hoc manner we currently use.
Scanning the kernel ...
I wasnt aware of this, neat; not many areas in the kernel seem to use
it. I find this stuff interesting, so i may get too verbose ;->
One approach i tried was to write an oom_handler - but it seemed to
get invoked a little too late, i.e when shit has already hit the fan.
If only i could get notified just before swap kicks in or just when some
preconfigured (by me) memmory threshold is hit.... This may do it? I
will experiment. Actually for it to work well, I will need to know when
the memory threshold is crossed as it goes down and when it is going up
as more memory gets freed.
I can see the shrinker working well with dynamically createable
entries (route cache, arp cache, contrack etc); shrinking a SAD, SPD,
FIB etc that was created by some user space app without user space
consent or at least notification may be unacceptable (imagine Quagga/BGP
adding FIB entries and the kernel deciding its gonna run out of mem and
starting to delete entries; worse deleting SAD entries may be a security
risk etc etc). My problem is more related to these sorts of user
controlled tables.
One approach that may work to address the above is to send a signal to
user space when the low mem threshold is approaching.. User space then
uses that info to slow down its abuse of memory. I think that signaling
maybe achievable by a genlmsg being sent to a multicast group which a
user space app will have to subscribe to.
Another approach is to use the shrinker callback to set a lowmem
condition to start rejecting any new table additions. A timer to
retry would take it back; a callback from the VM to say "you can go
ahead and alloc more now" would be better of course - i couldnt see this
anywhere in the VM code, but it is one of those subsystem i dont pay
attention to, it may be there.
Thoughts? ;->
cheers,
jamal
next prev parent reply other threads:[~2007-04-27 14:21 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2007-04-25 15:42 [PATCH][XFRM] export SAD info jamal
2007-04-25 15:54 ` jamal
2007-04-26 7:18 ` David Miller
2007-04-26 13:10 ` jamal
2007-04-26 21:18 ` David Miller
2007-04-27 14:21 ` jamal [this message]
2007-04-26 7:10 ` David Miller
2007-04-26 12:55 ` jamal
2007-04-26 21:12 ` David Miller
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=1177683705.4059.29.camel@localhost \
--to=hadi@cyberus.ca \
--cc=davem@davemloft.net \
--cc=netdev@vger.kernel.org \
/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;
as well as URLs for NNTP newsgroup(s).