Hello,
Please consider the following patch against 2.3.47.We should really have this
functionality in 2.4. It's rather useful for all sorts of extensions.
I've already fairly well tested the patch; as always there may still be some
strange bugs that I didn't catch :-)
Description
-----------
This patch adds register_cache() and unregister_cache() functions to the
kernel. The caches registered via that interface are shrunk when memory
needs to be freed, just like e.g. the dentry and inode caches.
Benefit: Modules, drivers, filesystems, etc. can register caches that
are shrunk only when necessary, rather than defining fixed-size caches.
This patch has no effect unless register_cache() is actually used.
This patch also adds a function rotate_list to <linux/list.h> that
rotates the list so that another list element becomes the list head.
It is used in mm/vmscan.c's do_try_to_free_pages() function to rotate
the list of caches when enough memory has been freed, so that the caches
are treated more fairly.
The patch also includes a test, which should finally be removed.
begin 644 register_cache.diff.gz
M'XL(",4!MS@``W)E9VES=&5R7V-A8VAE+F1I9F8`Q5I[<]I($O\;/D6?L^L%
M`P(),#9>9^,D3I9=QTYA[^/J<J42T@`ZA,3I88>D_-VONV<D)!!.-G57Y[(!
M3<_T]/3TX]>-[^9N!"LKMN=@.4X$H9BY42Q"T[;LN:C5P?(=2/R=X6GBV[$;
M^!'$`<1S45V(T!>>!G=S`3QIPTLX<.]:.,N*P?5Q8&K9`JQ00#0/$W\!#W/A
MPU(L@W!=]85PF.E$P#3$AR;\*XEB\-R%`*'---H-'.''X9J%<_W`2;?4JM67
MPA=3-Q["N\!)/!$UP0G=>Q'BAZF+SVN4:(D/(K8U7.5G4J92DYC5G'"![ZVE
MA+ZP1119X;H)H852A#371UFFKN_Z,^3_43BMR/V4$^=NH]^Y%8$?@)A.A1VC
M3E&8$GWC=,N.$\O#79-(.$4>EA<%\J*L[`H@#&(K%J:'C$AQ/WJNGWQLTZ,V
M?R[/(Z=$K#N>%P7R/BP_X)/PH/#$$A6+JK>#97[V7%@HR"@FZ4@H5#HLE^W[
M980:U.P?(G`"$R_$C`.3+LU<63,1Y<R$Y)(R5#.FP315.6M7^$$RFRLS8&5-
M!`XK&TCEC3/SXCN*0X$\'9A:;NBM65<BKRK7M[W$$:0N/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NY7-1L1D(4\^:15LM0>;QN5+9,*S@:C]>U`YN
M,X@E`\,!W.)?ROO\>Z<I.9Y_'WSP#YIRL<K\&PEX2OTLXZ[R>N=LL^-C8?O<
M9P6/]N4'*1:=&I/*YW3]029M,\<UIZ+<Q@RNE%[U)ASH!_7LV<!G(_?<Q><N
M/2MD5-H(D;VX5(,C$M3RW$\;)=+4"-4E<5UE*WS+J*IS*"TE&?M)W118/>78
MW+S<X]*2ML>9)?$;W%@M+#JP<5JH0I4#'P^V'5A\M)8KCX)^\(#X.WB@C$!I
MC[\8#I*))UJ4[X5LH"*@M\,@*O''*';<8,N?3//7R_'UY95I[OJ@^D8UUY+G
MKYX_JY:[8\76GF8Z-R`?-ZB=;:&DI?OO1"1"IN22?B\Q9]1%>(FGJNXM,,3B
M$?I\#IXD%'NU+.R1KQJF"C5M0!.1FTR229MEG-8.OG?@H`E^ZSF=KZZ:I1D5
MT##8;G<D8Q18)ED.Y?TO)5/^])B[KHTRI43%>_1UBAAHQ(_(U.#/!G_N\N<N
MY"Y0@9Z<>R,XN5T)&ST;G3JB+\_1T!GQY5%276*G3>GE=S79QS^4=W]6I!I/
M4O5=JK2L[>EJ=SF\F0_4:&-]N'$DO*D4[FD6.YLR$_F50OK_`U_#9OO<S(:!
MYY-<'B6$(:]V_;S^1]>C.W-3,Y<K[/^I["^KI&3_\A5</:OIVZ-ZZ6@W&Z5:
8ID/I0AGDV0:*YQ.QU/1_`,'JZ4<>)```
`
end
Regards,
Andreas Gruenbacher
------------------------------------------------------------------------
Andreas Gruenbacher, a.gruenbacher@computer.org
Contact information: http://www.bestbits.at/~agruenba
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.rutgers.edu
Please read the FAQ at http://www.tux.org/lkml/
This archive was generated by hypermail 2b29 : Tue Feb 29 2000 - 21:00:13 EST