VM: killing process X

V13 v13 at priest.com
Sat May 29 00:21:48 EEST 2004


On Friday 28 May 2004 23:38, ricudis at itc.auth.gr wrote:
> > On Friday 28 May 2004 16:44, Christos Ricudis wrote:
> >> To senario einai poly syxnotero apo oti fantazesai. Me opoiadhpote
> >> logikh kai na prospa8hseis na dialekseis TI 8a skotwseis,
> >> exeis megalh pi8anothta na skotwseis kapoio entelws asxeto process.
> >
> > apo to man page tis malloc :):
> >
> > -----
> > void *malloc(size_t size);
> >
> >        For calloc() and malloc(), the value returned is a pointer
> >        to the allocated memory, which is suitably aligned for any
> >        kind of variable, or NULL if the request fails.
> > -----
> >
> > Opote to mono poy menei einai o kernel na min kanei tipote oste
> > opoiodipote programma elegxei to apotelesma ton malloc() poy kanei
> > na min kindinevei na skotothei (Ta ypoloipa tha trone sigsegv)...
> > To mono poy xreiazetai einai
> > ena
> > echo 1 > /proc/sys/vm/overcommit_memory
> > h
> > echo 2 > /proc/sys/vm/overcommit_memory
> >
> > Apla epidi ayto den to kanei sxedon kanenas (including me), yparxei
> > (ypirxe) o oom killer... Tora, to oti kindinevei na soy skotosei
> > ton sshd kai na s'afisei ekso apo to mixanima, einai ena allo thema.
>
> Lypamai kyrie Stefane alla mallon to ma8hma twn leitourgikwn systhmatwn to
> dinate Iounio kai sas eixe piasei h anoiksh (ta poylakia poy kelahdane, oi
> petalouditses poy phdiountai apo louloudaki se louloudaki ktl).
>
> Otan kanw malloc() exw 2 pi8anothtes :
>
> 1) pairnw ena pointer pou deixnei se allocated mnhmh
> 2) pairnw ena null pointer.
>
> Akoma kai sthn periptwsh poy DEN elegksw to apotelesma ths malloc, me to
> poy 8a paw na grapsw ston null pointer (case 2) 8a faw sigsegv 8elw de
> 8elw. Sthn periptwsh 1) den 8a prepe na yparxei problhma outws h allws.

Mexri edo leme ta idia... Ayto poy eipes linei to problima apo mono toy xoris 
na yparxei anagki OOM killer kai einai akribos to idio me ayto poy anefera 
parapano :P.

BTW, o OOM killer leitoyrgei akribos stin 1h periptosi, opoy h malloc 
epitygxanei parolo poy den yparxei eleytheri mnimi (logo overcommit) kai sti 
synexeia to process paei na grapsei pano se ayti eno den yparxei eleytheri 
mnimi.

> Bebaia h malloc() den einai o monos tropos na desmeyseis mnhmh. Thn
> malloc() thn elegxeis. Den yparxei omes kanenas tropos na elegkseis an to
> epomeno function call poy 8a kaneis 8a apotyxei epeidh den yparxei xwros
> gia akoma ena stack frame. Fysika kai s'ayth thn periptwsh 8a fas sigsegv.

Ypotheto pos sxetika eykola mporeis na exei desmeymeni X KB o kernel oste na 
min yparxei periptosi na yparksei ayto to problima (afaik ayto to kanei idi, 
alios pos tha doylevan oi drivers kai o idios o oom killer?).

> To overcommit xrhsimeyei sthn periptwsh programmatwn poy kanoyn allocate
> mnhmh kai pote den grafoun s'ayth. 8a'8ela na dw ena paradeigma
> pragmatikou programmatos poy kanei kati tetoio. To prwto pragma poy
> moyrxetai sto myalo einai sparse matrix handling, alla etsi ki alliws otan
> kaneis allocate mnhmh ypoti8etai oti pairneis zero pages - den desmeyetai
> mnhmh mexri na kaneis to prwto write se mia selida.

Think of mmap(). Oles oi libs poy ginontai mmap() kanoyn ayto akribos poy 
eipes kai dedomenoy oti den mporeis na ksereis an einai h oxi prelinked, den 
mporeis na ksereis an tha xreastei na ginei write pano stin mmap()ed perioxi 
h oxi.

> O OOM handler grafthke gia na kanei kati diaforetiko. To problhma den
> einai  kapoios o opoios zhtaei ksafnika pollh mnhmh. To problhma einai
> kapoios poy zhtaei ligh ligh mnhmh, me thn diestrammenh elpida oti 8a
> ftasei to systhma se tetoio starvation poy 8a arxisei na skotwnei ASXETA
> processes poy prospa8oun ta kahmena na xwresoun kapou ta ftwxa, amoira
> dedomena tous. To pragmatiko problhma einai oti 8ewrhtika einai adynaton
> na breis ton offender.

> Praktika opws toxoume ksanapei, o offender einai synh8ws o mozilla :P

pragmati... kato apo k.s. ena 'killall mozilla-bin' prepei na einai mia xara 
gia oom killer. Dedomenoy toy oti skeytontai na afisoyn ayti ti doyleia se 
userspace programmata problepo pos tha doyme ricafr-oom-killer soon...

<<V13>>




More information about the Linux-greek-users mailing list