[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <87bltddsyk.fsf@ashishki-desk.ger.corp.intel.com>
Date: Fri, 15 Nov 2019 18:06:59 +0200
From: Alexander Shishkin <alexander.shishkin@...ux.intel.com>
To: tip-bot2 for Thomas Richter <tip-bot2@...utronix.de>,
linux-tip-commits@...r.kernel.org
Cc: Thomas Richter <tmricht@...ux.ibm.com>,
Peter Zijlstra <a.p.zijlstra@...llo.nl>,
Arnaldo Carvalho de Melo <acme@...hat.com>,
Jiri Olsa <jolsa@...hat.com>,
Linus Torvalds <torvalds@...ux-foundation.org>,
Mark Rutland <mark.rutland@....com>,
Namhyung Kim <namhyung@...nel.org>,
Peter Zijlstra <peterz@...radead.org>,
Thomas Gleixner <tglx@...utronix.de>, acme@...nel.org,
gor@...ux.ibm.com, hechaol@...com, heiko.carstens@...ibm.com,
linux-perf-users@...r.kernel.org, songliubraving@...com,
Ingo Molnar <mingo@...nel.org>, Borislav Petkov <bp@...en8.de>,
linux-kernel@...r.kernel.org, alexander.shishkin@...ux.intel.com
Subject: Re: [tip: perf/urgent] perf/aux: Fix tracking of auxiliary trace buffer allocation
"tip-bot2 for Thomas Richter" <tip-bot2@...utronix.de> writes:
> /* now it's safe to free the pages */
> - atomic_long_sub(rb->aux_nr_pages, &mmap_user->locked_vm);
> - atomic64_sub(rb->aux_mmap_locked, &vma->vm_mm->pinned_vm);
> + if (!rb->aux_mmap_locked)
> + atomic_long_sub(rb->aux_nr_pages, &mmap_user->locked_vm);
> + else
> + atomic64_sub(rb->aux_mmap_locked, &vma->vm_mm->pinned_vm);
This only works correctly when rb->aux_mmap_locked is either equal to
rb->aux_nr_pages or zero. Otherwise, it leaks
rb->aux_nr_pages - rb->aux_mmap_locked
in the locked_vm permanently.
Regards,
--
Alex
Powered by blists - more mailing lists