Re: freepages in proc doesn't work right.

Kevin M. Bealer (kmb203@psu.edu)
Tue, 22 Jul 1997 22:16:29 -0400


"Russell Coker - mailing lists account" wrote:
>>Noticed this in 2.0.30:
>
>>The command to set the "freepages" file in /proc/sys/vm used to work like
>>thus:
>
>>echo 100 150 200 > /proc/sys/vm/freepages
>
>>Now, what you get is something like:
>
>
>>200 96 128
>
>>where 96 and 128 are the originals.
>
>>I don't know when this changed, but the problem seems
>>to be that it doesn't like spaces in the input.
>
> I noticed the same thing in 2.1.3x. I just do:
>echo "100 150 200" > /proc/sys/vm/freepages
>
> It works for me.
>
>--

yes, works here too that way.. hmmm.

(quote from strace sh):

write(1, "1", 1) = 1
write(1, " 2", 2) = 2
write(1, " 3", 2) = 2
write(1, "\n", 1)

(quote from strace /bin/echo):

write(1, "1 2 3\n", 6)

->

This used to work, I suspect "bash" changed policy....

So I guess the question is, is the kernel supposed to put up with
multiple writes to /proc devices and interpret them as one command if
the file is not closed in between? This could become a problem if
/proc files ever get big.

Imaging writing 10K of "ip rules" into a future kernel. No way to do
an atomic write in that case, so you get it chopped however careful you
are.

>From a "principle of least surprise" I would say bash and the kernel
are both borderline here. Bash should buffer a -little- more and the
kernel should be a -little- more tolerant on this policy if possible.
(mostly so that proc can handle big requests, should that even become
necessary.)

--kmb203@psu.edu----------------Debian/GNU--1.3---Linux--2.0.30---
OK, so you're a Ph.D. Just don't touch anything.