linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* Re: [PATCH] Autoregulate vm swappiness cleanup
@ 2003-10-28 13:34 Boszormenyi Zoltan
  2003-10-28 14:39 ` Richard B. Johnson
  0 siblings, 1 reply; 8+ messages in thread
From: Boszormenyi Zoltan @ 2003-10-28 13:34 UTC (permalink / raw)
  To: linux-kernel

Hi,

this patch makes my system even more responsive,
I applied the patch over 2.6.0-test8-mm1.

I have a Glade v1 project that has these source files among others:

$ ls -l callbacks.[ch] interface.[ch]
-rw-rw-r--    1 zozo     zozo       583241 okt 28 13:06 callbacks.c
-rw-rw-r--    1 zozo     zozo        96592 okt 27 22:54 callbacks.h
-rw-rw-r--    1 zozo     zozo      1090912 okt 27 22:54 interface.c
-rw-rw-r--    1 zozo     zozo         1687 okt 27 22:54 interface.h

That said, among others: the projects is *very* large, and is reasonably
modularised before someone says something silly about my programming
capabilities. :-)

gcc-3.3.2 (latest Fedora packages) goes up 160M+ in memory usage,
For a test run I started mozilla with some very long pages, oowriter,
gedit with the listed files opened and some gnome-terminal and a new project
compile with make -j2 so the callbacks.c and interface.c were compiled
simultaneously.

The system is a dual PIII/500 MHz with 512M RAM, not a speedy machine.
With all these, the system used only ~36M swap. Free memory was about 3-6M
then I exited oowriter. Free mem suddenly went up to 75M+, starting
programs was almost instant.

Definitely a win.

-- 
Best regards,
Zoltán Böszörményi

---------------------
What did Hussein say about his knife?
One in Bush worth two in the hand.


^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [PATCH] Autoregulate vm swappiness cleanup
  2003-10-28 13:34 [PATCH] Autoregulate vm swappiness cleanup Boszormenyi Zoltan
@ 2003-10-28 14:39 ` Richard B. Johnson
  2003-10-28 15:39   ` Valdis.Kletnieks
  2003-11-03  8:15   ` [OT] " Boszormenyi Zoltan
  0 siblings, 2 replies; 8+ messages in thread
From: Richard B. Johnson @ 2003-10-28 14:39 UTC (permalink / raw)
  To: Boszormenyi Zoltan; +Cc: linux-kernel

On Tue, 28 Oct 2003, Boszormenyi Zoltan wrote:
[SNIPPED...]

> -rw-rw-r--    1 zozo     zozo      1090912 okt 27 22:54 interface.c
                                     ^^^^^^^
Guess you use `vim` to edit ...eh?

Linux does have a good linker, you know. You don't need to put
everything in one file!

Cheers,
Dick Johnson
Penguin : Linux version 2.4.22 on an i686 machine (797.90 BogoMips).
            Note 96.31% of all statistics are fiction.



^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [PATCH] Autoregulate vm swappiness cleanup
  2003-10-28 14:39 ` Richard B. Johnson
@ 2003-10-28 15:39   ` Valdis.Kletnieks
  2003-10-28 15:54     ` Richard B. Johnson
  2003-11-03  8:15   ` [OT] " Boszormenyi Zoltan
  1 sibling, 1 reply; 8+ messages in thread
From: Valdis.Kletnieks @ 2003-10-28 15:39 UTC (permalink / raw)
  To: root; +Cc: Boszormenyi Zoltan, linux-kernel

[-- Attachment #1: Type: text/plain, Size: 877 bytes --]

On Tue, 28 Oct 2003 09:39:53 EST, "Richard B. Johnson" said:
> On Tue, 28 Oct 2003, Boszormenyi Zoltan wrote:
> [SNIPPED...]
> 
> > -rw-rw-r--    1 zozo     zozo      1090912 okt 27 22:54 interface.c
>                                      ^^^^^^^
> Guess you use `vim` to edit ...eh?
> 
> Linux does have a good linker, you know. You don't need to put
> everything in one file!

On the flip side, if there's a lot of routines all declared 'static' so they are
only visible to that .c file, it's less than simple to split them out and
tell the *rest* of the projects that 'routines in interface/*.c are visible
to each other, but not to C code in database/*.c'.

The Linux kernel has the same issues:

% find . -name '*.[ch]' | xargs grep acpi_bus_unregister_driver

referenced only in drivers/acpi and one include file - but pollutes the global
linkage namespace all the same.

[-- Attachment #2: Type: application/pgp-signature, Size: 226 bytes --]

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [PATCH] Autoregulate vm swappiness cleanup
  2003-10-28 15:39   ` Valdis.Kletnieks
@ 2003-10-28 15:54     ` Richard B. Johnson
  2003-10-28 16:37       ` Valdis.Kletnieks
  0 siblings, 1 reply; 8+ messages in thread
From: Richard B. Johnson @ 2003-10-28 15:54 UTC (permalink / raw)
  To: Valdis.Kletnieks; +Cc: Boszormenyi Zoltan, linux-kernel

On Tue, 28 Oct 2003 Valdis.Kletnieks@vt.edu wrote:

> On Tue, 28 Oct 2003 09:39:53 EST, "Richard B. Johnson" said:
> > On Tue, 28 Oct 2003, Boszormenyi Zoltan wrote:
> > [SNIPPED...]
> >
> > > -rw-rw-r--    1 zozo     zozo      1090912 okt 27 22:54 interface.c
> >                                      ^^^^^^^
> > Guess you use `vim` to edit ...eh?
> >
> > Linux does have a good linker, you know. You don't need to put
> > everything in one file!
>
> On the flip side, if there's a lot of routines all declared 'static' so they are
> only visible to that .c file, it's less than simple to split them out and
> tell the *rest* of the projects that 'routines in interface/*.c are visible
> to each other, but not to C code in database/*.c'.
>
> The Linux kernel has the same issues:
>
> % find . -name '*.[ch]' | xargs grep acpi_bus_unregister_driver
>
> referenced only in drivers/acpi and one include file - but pollutes the global
> linkage namespace all the same.
>

I keep hearing 'pollutes the global namespace' all the time, now. Do
you mean that 'C' code designers actually intend to use the same
name for different procedures or objects in different files?

If so, that's a problem of idiocy, not pollution. Anybody who
writes code for a living would not do that, now would they??

The fact that there may be many global references that need to
be resolved by the linker is not pollution. It's using tools to
simplify design, implementation, testing, and maintenance.

Cheers,
Dick Johnson
Penguin : Linux version 2.4.22 on an i686 machine (797.90 BogoMips).
            Note 96.31% of all statistics are fiction.



^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [PATCH] Autoregulate vm swappiness cleanup
  2003-10-28 15:54     ` Richard B. Johnson
@ 2003-10-28 16:37       ` Valdis.Kletnieks
  2003-10-28 16:51         ` Måns Rullgård
  0 siblings, 1 reply; 8+ messages in thread
From: Valdis.Kletnieks @ 2003-10-28 16:37 UTC (permalink / raw)
  To: root; +Cc: Boszormenyi Zoltan, linux-kernel

[-- Attachment #1: Type: text/plain, Size: 1221 bytes --]

On Tue, 28 Oct 2003 10:54:56 EST, "Richard B. Johnson" said:

> I keep hearing 'pollutes the global namespace' all the time, now. Do
> you mean that 'C' code designers actually intend to use the same
> name for different procedures or objects in different files?

Right. Exactly.

That's why you need to have module1_debug_level, module2_debug_level,
module3_debug_level and so on, rather than have a 'debug_level' that's visible
in module1, another that's visible in module2, and a third that's visible in
module3. Note that you *CAN* do that if module1, module2, and module3 are all
*single* .c files simply by declaring it 'static int debug_level;'.  But if you
decide to splt module1 and module2 into 2 .c files each, suddenly you need to
rename *both* variables....

And I'm *positive* that *nobody* on this list has done that, forgotten to
rename the variables, and then wondered why module1 has 'debug_level = 1;' in
it and the debugging output starts and then mysteriously stops some random time
after (because module2 has 'debug_level = 0;' in it...)

Yes, C does not have a C++ idea of "private data".  My point is that quite
often, the use of 'static' to simulate it is the reason for very large .c
files....


[-- Attachment #2: Type: application/pgp-signature, Size: 226 bytes --]

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [PATCH] Autoregulate vm swappiness cleanup
  2003-10-28 16:37       ` Valdis.Kletnieks
@ 2003-10-28 16:51         ` Måns Rullgård
  2003-10-28 17:33           ` Valdis.Kletnieks
  0 siblings, 1 reply; 8+ messages in thread
From: Måns Rullgård @ 2003-10-28 16:51 UTC (permalink / raw)
  To: linux-kernel

Valdis.Kletnieks@vt.edu writes:

> And I'm *positive* that *nobody* on this list has done that,
> forgotten to rename the variables, and then wondered why module1 has
> 'debug_level = 1;' in it and the debugging output starts and then
> mysteriously stops some random time after (because module2 has
> 'debug_level = 0;' in it...)

Doing that mistake would give a linker error.

-- 
Måns Rullgård
mru@kth.se


^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [PATCH] Autoregulate vm swappiness cleanup
  2003-10-28 16:51         ` Måns Rullgård
@ 2003-10-28 17:33           ` Valdis.Kletnieks
  0 siblings, 0 replies; 8+ messages in thread
From: Valdis.Kletnieks @ 2003-10-28 17:33 UTC (permalink / raw)
  To: Måns Rullgård; +Cc: linux-kernel

[-- Attachment #1: Type: text/plain, Size: 1042 bytes --]

On Tue, 28 Oct 2003 17:51:48 +0100, mru@kth.se (=?iso-8859-1?q?M=E5ns_Rullg=E5rd?=)  said:

> Doing that mistake would give a linker error.

Not necessarily.  Consider shared libraries.  Load module1.so, load module2.so,
and then load module3.so that has an unresolved reference that both of the
other two happen to have. Oh wow.. results that are dependent on the order of
-l flags in a non-obvious way...  And '-z muldefs' is always a good way to
shoot yourself in the foot.....

Yes, it's stupid, yes, it's a mistake - my point is that the design of C makes that
sort of mistake more likely.  If there *did* exist a "private to all the pieces of the
module" status similar to the "private to THIS .c 'static'", it wouldn't be anywhere
near the problem.

And don't tell me that the Linux kernel hasn't seen similar issues - a supposedly
private interface that didn't have 'static' because it *was* called from 2 other
.c files in the directory.  And then we have to tell people "don't call that interface,
it's private".

[-- Attachment #2: Type: application/pgp-signature, Size: 226 bytes --]

^ permalink raw reply	[flat|nested] 8+ messages in thread

* [OT] Re: [PATCH] Autoregulate vm swappiness cleanup
  2003-10-28 14:39 ` Richard B. Johnson
  2003-10-28 15:39   ` Valdis.Kletnieks
@ 2003-11-03  8:15   ` Boszormenyi Zoltan
  1 sibling, 0 replies; 8+ messages in thread
From: Boszormenyi Zoltan @ 2003-11-03  8:15 UTC (permalink / raw)
  To: root; +Cc: linux-kernel

Richard B. Johnson írta:
> On Tue, 28 Oct 2003, Boszormenyi Zoltan wrote:
> [SNIPPED...]
> 
> 
>>-rw-rw-r--    1 zozo     zozo      1090912 okt 27 22:54 interface.c
> 
>                                      ^^^^^^^
> Guess you use `vim` to edit ...eh?
> 
> Linux does have a good linker, you know. You don't need to put
> everything in one file!
> 
> Cheers,
> Dick Johnson

Ehm, yes, I know. But I guess you don't use Glade, do you?
interface[.ch] are completely generated by Glade, all the
create_windowXXX() functions are dumped into these files
and created from scratch all the time you save/regenerate
the project's source. The project grew over time, it's
pretty large now.

-- 
Best regards,
Zoltán Böszörményi

---------------------
What did Hussein say about his knife?
One in Bush worth two in the hand.


^ permalink raw reply	[flat|nested] 8+ messages in thread

end of thread, other threads:[~2003-11-03  8:15 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2003-10-28 13:34 [PATCH] Autoregulate vm swappiness cleanup Boszormenyi Zoltan
2003-10-28 14:39 ` Richard B. Johnson
2003-10-28 15:39   ` Valdis.Kletnieks
2003-10-28 15:54     ` Richard B. Johnson
2003-10-28 16:37       ` Valdis.Kletnieks
2003-10-28 16:51         ` Måns Rullgård
2003-10-28 17:33           ` Valdis.Kletnieks
2003-11-03  8:15   ` [OT] " Boszormenyi Zoltan

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).