[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <928CFBE8E7CB0040959E56B4EA41A77E0CC3A802@irsmsx504.ger.corp.intel.com>
Date: Thu, 18 Dec 2008 15:57:53 +0000
From: "Metzger, Markus T" <markus.t.metzger@...el.com>
To: Andrew Morton <akpm@...ux-foundation.org>,
Ingo Molnar <mingo@...e.hu>
CC: Peter Zijlstra <a.p.zijlstra@...llo.nl>,
"linux-kernel@...r.kernel.org" <linux-kernel@...r.kernel.org>,
"tglx@...utronix.de" <tglx@...utronix.de>,
"hpa@...or.com" <hpa@...or.com>,
"markus.t.metzger@...il.com" <markus.t.metzger@...il.com>,
"roland@...hat.com" <roland@...hat.com>,
"eranian@...glemail.com" <eranian@...glemail.com>
Subject: RE: [rfc] x86, ptrace: memory accounting for branch tracing
>-----Original Message-----
>From: Andrew Morton [mailto:akpm@...ux-foundation.org]
>Sent: Dienstag, 16. Dezember 2008 19:18
>To: Ingo Molnar
>Cc: Metzger, Markus T; Peter Zijlstra;
>> > Account memory allocated for the BTS buffer to the traced task's
>> > total_vm and locked_vm.
>>
>> Andrew, is this the right (and preferred) way to attach BTS buffer
>> allocation overhead to the RLIMIT_MEMLOCK bucket:
>
>Close. I suspect we could refactor mlock.c to avoid all the code
>duplication we have there.
>
>There's (almost) nothing BTS-specific in this code, and it would be
>better if it lived in mm/mlock.c. Hopefully in a
>usable-by-other-parts-of-mlock.c fashion.
Thanks,
I added alloc_locked_buffer() and free_locked_buffer() functions to mm/mlock.c.
>> > +static int ptrace_bts_allocate_buffer(struct task_struct
>*child, size_t size)
>> > +{
>> > + unsigned long rlim, vm, pgsz;
>> > + int error = -ENOMEM;
>> > +
>> > + pgsz = PAGE_ALIGN(size) >> PAGE_SHIFT;
>> > +
>> > + down_write(&child->mm->mmap_sem);
>> > +
>> > + rlim = child->signal->rlim[RLIMIT_AS].rlim_cur >> PAGE_SHIFT;
>> > + vm = child->mm->total_vm + pgsz;
>> > + if (rlim < vm)
>
>This is off-by-one, I think. Should be
>
> if (vm > rmlim)
>
Those two should be equivalent, shouldn't they?
regards,
markus.
---------------------------------------------------------------------
Intel GmbH
Dornacher Strasse 1
85622 Feldkirchen/Muenchen Germany
Sitz der Gesellschaft: Feldkirchen bei Muenchen
Geschaeftsfuehrer: Douglas Lusk, Peter Gleissner, Hannes Schwaderer
Registergericht: Muenchen HRB 47456 Ust.-IdNr.
VAT Registration No.: DE129385895
Citibank Frankfurt (BLZ 502 109 00) 600119052
This e-mail and any attachments may contain confidential material for
the sole use of the intended recipient(s). Any review or distribution
by others is strictly prohibited. If you are not the intended
recipient, please contact the sender and delete all copies.
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists