Re: [PATCH v2 1/6] mm: introduce vma->vm_flags modifier functions

2023-01-26 Thread Suren Baghdasaryan
On Thu, Jan 26, 2023 at 7:09 AM Matthew Wilcox wrote: > > On Thu, Jan 26, 2023 at 04:50:59PM +0200, Mike Rapoport wrote: > > On Thu, Jan 26, 2023 at 11:17:09AM +0200, Mike Rapoport wrote: > > > On Wed, Jan 25, 2023 at 12:38:46AM -0800, Suren Baghdasaryan wrote: >

Re: [PATCH v2 1/6] mm: introduce vma->vm_flags modifier functions

2023-01-25 Thread Suren Baghdasaryan
On Wed, Jan 25, 2023 at 10:33 AM Matthew Wilcox wrote: > > On Wed, Jan 25, 2023 at 12:38:46AM -0800, Suren Baghdasaryan wrote: > > +/* Use when VMA is not part of the VMA tree and needs no locking */ > > +static inline void init_vm_flags(struct v

Re: [PATCH v2 5/6] mm: introduce mod_vm_flags_nolock and use it in untrack_pfn

2023-01-25 Thread Suren Baghdasaryan
On Wed, Jan 25, 2023 at 1:42 AM Michal Hocko wrote: > > On Wed 25-01-23 00:38:50, Suren Baghdasaryan wrote: > > In cases when VMA flags are modified after VMA was isolated and mmap_lock > > was downgraded, flags modifications would result in an assertion because > > mma

Re: [PATCH v2 1/6] mm: introduce vma->vm_flags modifier functions

2023-01-25 Thread Suren Baghdasaryan
On Wed, Jan 25, 2023 at 1:10 AM Peter Zijlstra wrote: > > On Wed, Jan 25, 2023 at 12:38:46AM -0800, Suren Baghdasaryan wrote: > > > diff --git a/include/linux/mm_types.h b/include/linux/mm_types.h > > index 2d6d790d9bed..6c7c70bf50dd 100644 > > --- a/include/linux/m

Re: [PATCH v2 3/6] mm: replace vma->vm_flags direct modifications with modifier calls

2023-01-25 Thread Suren Baghdasaryan
On Wed, Jan 25, 2023 at 1:30 AM 'Michal Hocko' via kernel-team wrote: > > On Wed 25-01-23 00:38:48, Suren Baghdasaryan wrote: > > Replace direct modifications to vma->vm_flags with calls to modifier > > functions to be able to track flag changes and to keep vma lo

Re: [PATCH v2 4/6] mm: replace vma->vm_flags indirect modification in ksm_madvise

2023-01-25 Thread Suren Baghdasaryan
On Wed, Jan 25, 2023 at 9:08 AM Michal Hocko wrote: > > On Wed 25-01-23 08:57:48, Suren Baghdasaryan wrote: > > On Wed, Jan 25, 2023 at 1:38 AM 'Michal Hocko' via kernel-team > > wrote: > > > > > > On Wed 25-01-23 00:38:49, Suren Baghdasaryan wrote: > >

Re: [PATCH v2 1/6] mm: introduce vma->vm_flags modifier functions

2023-01-25 Thread Suren Baghdasaryan
On Wed, Jan 25, 2023 at 10:37 AM Matthew Wilcox wrote: > > On Wed, Jan 25, 2023 at 08:49:50AM -0800, Suren Baghdasaryan wrote: > > On Wed, Jan 25, 2023 at 1:10 AM Peter Zijlstra wrote: > > > > + /* > > > > + * Flags, see mm.h. > > &g

Re: [PATCH v2 4/6] mm: replace vma->vm_flags indirect modification in ksm_madvise

2023-01-25 Thread Suren Baghdasaryan
On Wed, Jan 25, 2023 at 1:38 AM 'Michal Hocko' via kernel-team wrote: > > On Wed 25-01-23 00:38:49, Suren Baghdasaryan wrote: > > Replace indirect modifications to vma->vm_flags with calls to modifier > > functions to be able to track flag changes and to keep vma locking

[PATCH v2 5/6] mm: introduce mod_vm_flags_nolock and use it in untrack_pfn

2023-01-25 Thread Suren Baghdasaryan
mod_vm_flags_nolock for flags modification and to avoid assertion. Signed-off-by: Suren Baghdasaryan --- arch/x86/mm/pat/memtype.c | 10 +++--- include/linux/mm.h| 12 +--- include/linux/pgtable.h | 5 +++-- mm/memory.c | 13 +++-- mm/memremap.c | 4

[PATCH v2 4/6] mm: replace vma->vm_flags indirect modification in ksm_madvise

2023-01-25 Thread Suren Baghdasaryan
Replace indirect modifications to vma->vm_flags with calls to modifier functions to be able to track flag changes and to keep vma locking correctness. Add a BUG_ON check in ksm_madvise() to catch indirect vm_flags modification attempts. Signed-off-by: Suren Baghdasaryan --- arch/powerpc/

[PATCH v2 3/6] mm: replace vma->vm_flags direct modifications with modifier calls

2023-01-25 Thread Suren Baghdasaryan
Replace direct modifications to vma->vm_flags with calls to modifier functions to be able to track flag changes and to keep vma locking correctness. Signed-off-by: Suren Baghdasaryan --- arch/arm/kernel/process.c | 2 +- arch/ia64/mm/ini

[PATCH v2 6/6] mm: export dump_mm()

2023-01-25 Thread Suren Baghdasaryan
mmap_assert_write_locked() is used in vm_flags modifiers. Because mmap_assert_write_locked() uses dump_mm() and vm_flags are sometimes modified from from inside a module, it's necessary to export dump_mm() function. Signed-off-by: Suren Baghdasaryan --- mm/debug.c | 1 + 1 file changed, 1

[PATCH v2 1/6] mm: introduce vma->vm_flags modifier functions

2023-01-25 Thread Suren Baghdasaryan
are updated. This way we can better check and control correct locking behavior during these updates. Signed-off-by: Suren Baghdasaryan --- include/linux/mm.h | 37 + include/linux/mm_types.h | 8 +++- 2 files changed, 44 insertions(+), 1 deletion

[PATCH v2 0/6] introduce vm_flags modifier functions

2023-01-25 Thread Suren Baghdasaryan
://lore.kernel.org/all/20230109205336.3665937-1-sur...@google.com/ The patchset applies cleanly over mm-unstable branch of mm tree. My apologies for an extremely large distribution list. The patch touches lots of files and many are in arch/ and drivers/. Suren Baghdasaryan (6): mm: introduce

[PATCH v2 2/6] mm: replace VM_LOCKED_CLEAR_MASK with VM_LOCKED_MASK

2023-01-25 Thread Suren Baghdasaryan
To simplify the usage of VM_LOCKED_CLEAR_MASK in clear_vm_flags(), replace it with VM_LOCKED_MASK bitmask and convert all users. Signed-off-by: Suren Baghdasaryan --- include/linux/mm.h | 4 ++-- kernel/fork.c | 2 +- mm/hugetlb.c | 4 ++-- mm/mlock.c | 6 +++--- mm/mmap.c

Re: [RFC PATCH 00/30] Code tagging framework and applications

2022-09-08 Thread Suren Baghdasaryan
On Wed, Sep 7, 2022 at 11:35 PM Kent Overstreet wrote: > > On Wed, Sep 07, 2022 at 09:45:18AM -0400, Steven Rostedt wrote: > > On Wed, 7 Sep 2022 09:04:28 -0400 > > Kent Overstreet wrote: > > > > > On Wed, Sep 07, 2022 at 01:00:09PM +0200, Michal Hocko wrote: > > > > Hmm, it seems that further

Re: [RFC PATCH 00/30] Code tagging framework and applications

2022-09-06 Thread Suren Baghdasaryan
On Tue, Sep 6, 2022 at 1:01 AM Michal Hocko wrote: > > On Mon 05-09-22 11:03:35, Suren Baghdasaryan wrote: > > On Mon, Sep 5, 2022 at 1:12 AM Michal Hocko wrote: > > > > > > On Sun 04-09-22 18:32:58, Suren Baghdasaryan wrote: > > > > On Thu, S

Re: [RFC PATCH 00/30] Code tagging framework and applications

2022-09-05 Thread Suren Baghdasaryan
On Mon, Sep 5, 2022 at 8:06 AM Steven Rostedt wrote: > > On Sun, 4 Sep 2022 18:32:58 -0700 > Suren Baghdasaryan wrote: > > > Page allocations (overheads are compared to get_free_pages() duration): > > 6.8% Codetag counter manipulations (__lazy_percpu_counter_add + >

Re: [RFC PATCH 00/30] Code tagging framework and applications

2022-09-05 Thread Suren Baghdasaryan
On Mon, Sep 5, 2022 at 1:58 AM Marco Elver wrote: > > On Mon, 5 Sept 2022 at 10:12, Michal Hocko wrote: > > On Sun 04-09-22 18:32:58, Suren Baghdasaryan wrote: > > > On Thu, Sep 1, 2022 at 12:15 PM Michal Hocko wrote: > > [...] > > > > Yes, tracking bac

Re: [RFC PATCH 00/30] Code tagging framework and applications

2022-09-05 Thread Suren Baghdasaryan
On Mon, Sep 5, 2022 at 1:12 AM Michal Hocko wrote: > > On Sun 04-09-22 18:32:58, Suren Baghdasaryan wrote: > > On Thu, Sep 1, 2022 at 12:15 PM Michal Hocko wrote: > [...] > > > Yes, tracking back the call trace would be really needed. The question > > > is whe

Re: [RFC PATCH 00/30] Code tagging framework and applications

2022-09-04 Thread Suren Baghdasaryan
On Thu, Sep 1, 2022 at 12:15 PM Michal Hocko wrote: > > On Thu 01-09-22 08:33:19, Suren Baghdasaryan wrote: > > On Thu, Sep 1, 2022 at 12:18 AM Michal Hocko wrote: > [...] > > > So I find Peter's question completely appropriate while your response to > > &g

Re: [RFC PATCH 14/30] mm: prevent slabobj_ext allocations for slabobj_ext and kmem_cache objects

2022-09-01 Thread Suren Baghdasaryan
On Thu, Sep 1, 2022 at 4:41 PM Roman Gushchin wrote: > > On Tue, Aug 30, 2022 at 02:49:03PM -0700, Suren Baghdasaryan wrote: > > Use __GFP_NO_OBJ_EXT to prevent recursions when allocating slabobj_ext > > objects. Also prevent slabobj_ext allocations for kmem_cache objects.

Re: [RFC PATCH 11/30] mm: introduce slabobj_ext to support slab object extensions

2022-09-01 Thread Suren Baghdasaryan
On Thu, Sep 1, 2022 at 4:36 PM Roman Gushchin wrote: > > On Tue, Aug 30, 2022 at 02:49:00PM -0700, Suren Baghdasaryan wrote: > > Currently slab pages can store only vectors of obj_cgroup pointers in > > page->memcg_data. Introduce slabobj_ext structure to allow more data >

Re: [RFC PATCH 00/30] Code tagging framework and applications

2022-09-01 Thread Suren Baghdasaryan
On Thu, Sep 1, 2022 at 3:54 PM Roman Gushchin wrote: > > On Thu, Sep 01, 2022 at 06:37:20PM -0400, Kent Overstreet wrote: > > On Thu, Sep 01, 2022 at 03:27:27PM -0700, Roman Gushchin wrote: > > > On Wed, Aug 31, 2022 at 01:56:08PM -0700, Yosry Ahmed wrote: > > > > This is very interesting work!

Re: [RFC PATCH 00/30] Code tagging framework and applications

2022-09-01 Thread Suren Baghdasaryan
On Thu, Sep 1, 2022 at 12:15 PM Michal Hocko wrote: > > On Thu 01-09-22 08:33:19, Suren Baghdasaryan wrote: > > On Thu, Sep 1, 2022 at 12:18 AM Michal Hocko wrote: > [...] > > > So I find Peter's question completely appropriate while your response to > > &g

Re: [RFC PATCH 00/30] Code tagging framework and applications

2022-09-01 Thread Suren Baghdasaryan
On Thu, Sep 1, 2022 at 8:07 AM David Hildenbrand wrote: > > On 01.09.22 16:23, Kent Overstreet wrote: > > On Thu, Sep 01, 2022 at 10:05:03AM +0200, David Hildenbrand wrote: > >> On 31.08.22 21:01, Kent Overstreet wrote: > >>> On Wed, Aug 31, 2022 at 12:47:32PM +0200, Michal Hocko wrote: > On

Re: [RFC PATCH 00/30] Code tagging framework and applications

2022-09-01 Thread Suren Baghdasaryan
On Thu, Sep 1, 2022 at 12:18 AM Michal Hocko wrote: > > On Wed 31-08-22 15:01:54, Kent Overstreet wrote: > > On Wed, Aug 31, 2022 at 12:47:32PM +0200, Michal Hocko wrote: > > > On Wed 31-08-22 11:19:48, Mel Gorman wrote: > > > > Whatever asking for an explanation as to why equivalent

Re: [RFC PATCH 00/30] Code tagging framework and applications

2022-08-31 Thread Suren Baghdasaryan
On Wed, Aug 31, 2022 at 9:52 PM Oscar Salvador wrote: > > On Tue, Aug 30, 2022 at 02:48:49PM -0700, Suren Baghdasaryan wrote: > > === > > Code tagging framework > > === > > Code tag is a structure identifying a specif

Re: [RFC PATCH 10/30] mm: enable page allocation tagging for __get_free_pages and alloc_pages

2022-08-31 Thread Suren Baghdasaryan
On Wed, Aug 31, 2022 at 10:46 AM Kent Overstreet wrote: > > On Wed, Aug 31, 2022 at 11:11:03AM +0100, Mel Gorman wrote: > > On Tue, Aug 30, 2022 at 02:48:59PM -0700, Suren Baghdasaryan wrote: > > > Redefine alloc_pages, __get_free_pages to record allocations done by

Re: [RFC PATCH 00/30] Code tagging framework and applications

2022-08-31 Thread Suren Baghdasaryan
On Wed, Aug 31, 2022 at 1:56 PM Yosry Ahmed wrote: > > On Wed, Aug 31, 2022 at 12:02 PM Kent Overstreet > wrote: > > > > On Wed, Aug 31, 2022 at 12:47:32PM +0200, Michal Hocko wrote: > > > On Wed 31-08-22 11:19:48, Mel Gorman wrote: > > > > Whatever asking for an explanation as to why equivalent

Re: [RFC PATCH 00/30] Code tagging framework and applications

2022-08-31 Thread Suren Baghdasaryan
On Wed, Aug 31, 2022 at 8:28 AM Suren Baghdasaryan wrote: > > On Wed, Aug 31, 2022 at 3:47 AM Michal Hocko wrote: > > > > On Wed 31-08-22 11:19:48, Mel Gorman wrote: > > > On Wed, Aug 31, 2022 at 04:42:30AM -0400, Kent Overstreet wrote: > > > > On Wed,

Re: [RFC PATCH 22/30] Code tagging based fault injection

2022-08-31 Thread Suren Baghdasaryan
On Tue, Aug 30, 2022 at 6:52 PM Randy Dunlap wrote: > > > > On 8/30/22 14:49, Suren Baghdasaryan wrote: > > From: Kent Overstreet > > > > This adds a new fault injection capability, based on code tagging. > > > > To use, simply insert some

Re: [RFC PATCH 27/30] Code tagging based latency tracking

2022-08-31 Thread Suren Baghdasaryan
On Tue, Aug 30, 2022 at 6:53 PM Randy Dunlap wrote: > > > > On 8/30/22 14:49, Suren Baghdasaryan wrote: > > diff --git a/lib/Kconfig.debug b/lib/Kconfig.debug > > index b7d03afbc808..b0f86643b8f0 100644 > > --- a/lib/Kconfig.debug > > +++ b/lib/Kconfig.deb

Re: [RFC PATCH 10/30] mm: enable page allocation tagging for __get_free_pages and alloc_pages

2022-08-31 Thread Suren Baghdasaryan
On Wed, Aug 31, 2022 at 8:45 AM Suren Baghdasaryan wrote: > > On Wed, Aug 31, 2022 at 3:11 AM Mel Gorman wrote: > > > > On Tue, Aug 30, 2022 at 02:48:59PM -0700, Suren Baghdasaryan wrote: > > > Redefine alloc_pages, __get_free_pages to record allocations done by > &

Re: [RFC PATCH 22/30] Code tagging based fault injection

2022-08-31 Thread Suren Baghdasaryan
On Wed, Aug 31, 2022 at 3:37 AM Dmitry Vyukov wrote: > > On Tue, 30 Aug 2022 at 23:50, Suren Baghdasaryan wrote: > > > > From: Kent Overstreet > > > > This adds a new fault injection capability, based on code tagging. > > > > To use, simply insert some

Re: [RFC PATCH 10/30] mm: enable page allocation tagging for __get_free_pages and alloc_pages

2022-08-31 Thread Suren Baghdasaryan
On Wed, Aug 31, 2022 at 3:11 AM Mel Gorman wrote: > > On Tue, Aug 30, 2022 at 02:48:59PM -0700, Suren Baghdasaryan wrote: > > Redefine alloc_pages, __get_free_pages to record allocations done by > > these functions. Instrument deallocation hooks to record object freeing.

Re: [RFC PATCH 03/30] Lazy percpu counters

2022-08-31 Thread Suren Baghdasaryan
On Wed, Aug 31, 2022 at 3:02 AM Mel Gorman wrote: > > On Tue, Aug 30, 2022 at 02:48:52PM -0700, Suren Baghdasaryan wrote: > > From: Kent Overstreet > > > > This patch adds lib/lazy-percpu-counter.c, which implements counters > > that start out as atomics, bu

Re: [RFC PATCH 00/30] Code tagging framework and applications

2022-08-31 Thread Suren Baghdasaryan
On Wed, Aug 31, 2022 at 3:47 AM Michal Hocko wrote: > > On Wed 31-08-22 11:19:48, Mel Gorman wrote: > > On Wed, Aug 31, 2022 at 04:42:30AM -0400, Kent Overstreet wrote: > > > On Wed, Aug 31, 2022 at 09:38:27AM +0200, Peter Zijlstra wrote: > > > > On Tue, Aug 30

[RFC PATCH 27/30] Code tagging based latency tracking

2022-08-30 Thread Suren Baghdasaryan
From: Kent Overstreet This adds the ability to easily instrument code for measuring latency. To use, add the following to calls to your code, at the start and end of the event you wish to measure: code_tag_time_stats_start(start_time); code_tag_time_stats_finish(start_time); Stastistics

[RFC PATCH 23/30] timekeeping: Add a missing include

2022-08-30 Thread Suren Baghdasaryan
From: Kent Overstreet We need ktime.h for ktime_t. Signed-off-by: Kent Overstreet --- include/linux/timekeeping.h | 1 + 1 file changed, 1 insertion(+) diff --git a/include/linux/timekeeping.h b/include/linux/timekeeping.h index fe1e467ba046..7c43e98cf211 100644 ---

[RFC PATCH 28/30] Improved symbolic error names

2022-08-30 Thread Suren Baghdasaryan
From: Kent Overstreet This patch adds per-error-site error codes, with error strings that include their file and line number. To use, change code that returns an error, e.g. return -ENOMEM; to return -ERR(ENOMEM); Then, errname() will return a string that includes the file and line

[RFC PATCH 29/30] dyndbg: Convert to code tagging

2022-08-30 Thread Suren Baghdasaryan
From: Kent Overstreet This converts dynamic debug to the new code tagging framework, which provides an interface for iterating over objects in a particular elf section. It also converts the debugfs interface from seq_file to the style used by other code tagging users, which also makes the code

[RFC PATCH 24/30] wait: Clean up waitqueue_entry initialization

2022-08-30 Thread Suren Baghdasaryan
From: Kent Overstreet Cleanup for code tagging latency tracking: Add an initializer, WAIT_FUNC_INITIALIZER(), to be used by initializers for structs that include wait_queue_entries. Also, change init_wait(), init_wait_entry etc. to be a wrapper around the new __init_waitqueue_entry(); more

[RFC PATCH 19/30] move stack capture functionality into a separate function for reuse

2022-08-30 Thread Suren Baghdasaryan
Make save_stack() function part of stackdepot API to be used outside of page_owner. Also rename task_struct's in_page_owner to in_capture_stack flag to better convey the wider use of this flag. Signed-off-by: Suren Baghdasaryan --- include/linux/sched.h | 6 ++-- include/linux

[RFC PATCH 26/30] bcache: Convert to lib/time_stats

2022-08-30 Thread Suren Baghdasaryan
From: Kent Overstreet This patch converts bcache to the new generic time_stats code lib/time_stats.c. The new code is from bcachefs, and has some changes from the version in bcache: - we now use ktime_get_ns(), not local_clock(). When the code was originally written multi processor systems

[RFC PATCH 25/30] lib/time_stats: New library for statistics on events

2022-08-30 Thread Suren Baghdasaryan
From: Kent Overstreet This adds a small new library for tracking statistics on events that have a duration, i.e. a start and end time. - number of events - rate/frequency - average duration - max duration - duration quantiles This code comes from bcachefs, and originally bcache: the next

[RFC PATCH 30/30] MAINTAINERS: Add entries for code tagging & related

2022-08-30 Thread Suren Baghdasaryan
4bcb 100644 --- a/MAINTAINERS +++ b/MAINTAINERS @@ -5111,6 +5111,19 @@ S: Supported F: Documentation/process/code-of-conduct-interpretation.rst F: Documentation/process/code-of-conduct.rst +CODE TAGGING +M: Suren Baghdasaryan +M: Kent Overstreet +S: Maintained +F:

[RFC PATCH 22/30] Code tagging based fault injection

2022-08-30 Thread Suren Baghdasaryan
From: Kent Overstreet This adds a new fault injection capability, based on code tagging. To use, simply insert somewhere in your code dynamic_fault("fault_class_name") and check whether it returns true - if so, inject the error. For example if (dynamic_fault("init")) return

[RFC PATCH 18/30] codetag: add codetag query helper functions

2022-08-30 Thread Suren Baghdasaryan
From: Kent Overstreet Provide codetag_query_parse() to parse codetag queries and codetag_matches_query() to check if the query affects a given codetag. Signed-off-by: Kent Overstreet --- include/linux/codetag.h | 27 lib/codetag.c | 135

[RFC PATCH 21/30] lib: implement context capture support for page and slab allocators

2022-08-30 Thread Suren Baghdasaryan
nclude/asm-generic/pgalloc.h line 63 disable" > \ /sys/kernel/debug/alloc_tags.ctx Note that disabling context capture will not clear already captured context but no new context will be captured. Signed-off-by: Suren Baghdasaryan --- include/linux/alloc_tag.h | 28 - include/linux

[RFC PATCH 17/30] lib/string.c: strsep_no_empty()

2022-08-30 Thread Suren Baghdasaryan
From: Kent Overstreet This adds a new helper which is like strsep, except that it skips empty tokens. Signed-off-by: Kent Overstreet --- include/linux/string.h | 1 + lib/string.c | 19 +++ 2 files changed, 20 insertions(+) diff --git a/include/linux/string.h

[RFC PATCH 16/30] mm: enable slab allocation tagging for kmalloc and friends

2022-08-30 Thread Suren Baghdasaryan
Redefine kmalloc, krealloc, kzalloc, kcalloc, etc. to record allocations and deallocations done by these functions. Signed-off-by: Suren Baghdasaryan Co-developed-by: Kent Overstreet Signed-off-by: Kent Overstreet --- include/linux/slab.h | 103 +-- mm

[RFC PATCH 15/30] lib: introduce slab allocation tagging

2022-08-30 Thread Suren Baghdasaryan
Introduce CONFIG_SLAB_ALLOC_TAGGING which provides helper functions to easily instrument slab allocators and adds a codetag_ref field into slabobj_ext to store a pointer to the allocation tag associated with the code that allocated the slab object. Signed-off-by: Suren Baghdasaryan Co-developed

[RFC PATCH 14/30] mm: prevent slabobj_ext allocations for slabobj_ext and kmem_cache objects

2022-08-30 Thread Suren Baghdasaryan
Use __GFP_NO_OBJ_EXT to prevent recursions when allocating slabobj_ext objects. Also prevent slabobj_ext allocations for kmem_cache objects. Signed-off-by: Suren Baghdasaryan --- mm/memcontrol.c | 2 ++ mm/slab.h | 6 ++ 2 files changed, 8 insertions(+) diff --git a/mm/memcontrol.c b

[RFC PATCH 11/30] mm: introduce slabobj_ext to support slab object extensions

2022-08-30 Thread Suren Baghdasaryan
so avoiding this until v1. Signed-off-by: Suren Baghdasaryan --- include/linux/memcontrol.h | 18 -- init/Kconfig | 5 ++ mm/kfence/core.c | 2 +- mm/memcontrol.c| 60 ++- mm/page_owner.c| 2 +- mm/sla

[RFC PATCH 09/30] change alloc_pages name in dma_map_ops to avoid name conflicts

2022-08-30 Thread Suren Baghdasaryan
After redefining alloc_pages, all uses of that name are being replaced. Change the conflicting names to prevent preprocessor from replacing them when it's not intended. Signed-off-by: Suren Baghdasaryan --- arch/x86/kernel/amd_gart_64.c | 2 +- drivers/iommu/dma-iommu.c | 2 +- drivers/xen

[RFC PATCH 10/30] mm: enable page allocation tagging for __get_free_pages and alloc_pages

2022-08-30 Thread Suren Baghdasaryan
Redefine alloc_pages, __get_free_pages to record allocations done by these functions. Instrument deallocation hooks to record object freeing. Signed-off-by: Suren Baghdasaryan --- include/linux/gfp.h | 10 +++--- include/linux/page_ext.h| 3 ++- include/linux/pgalloc_tag.h | 35

[RFC PATCH 12/30] mm: introduce __GFP_NO_OBJ_EXT flag to selectively prevent slabobj_ext creation

2022-08-30 Thread Suren Baghdasaryan
Introduce __GFP_NO_OBJ_EXT flag in order to prevent recursive allocations when allocating slabobj_ext on a slab. Signed-off-by: Suren Baghdasaryan --- include/linux/gfp_types.h | 12 ++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/include/linux/gfp_types.h b/include

[RFC PATCH 20/30] lib: introduce support for storing code tag context

2022-08-30 Thread Suren Baghdasaryan
to its codetag_with_ctx object with embedded codetag object in it. All context objects of the same code tag are placed into codetag_with_ctx.ctx_head linked list. codetag.flag is used to indicate when a context capture for the associated code tag is initialized and enabled. Signed-off-by: Suren

[RFC PATCH 08/30] lib: introduce page allocation tagging

2022-08-30 Thread Suren Baghdasaryan
Introduce CONFIG_PAGE_ALLOC_TAGGING which provides helper functions to easily instrument page allocators and adds a page_ext field to store a pointer to the allocation tag associated with the code that allocated the page. Signed-off-by: Suren Baghdasaryan Co-developed-by: Kent Overstreet Signed

[RFC PATCH 04/30] scripts/kallysms: Always include __start and __stop symbols

2022-08-30 Thread Suren Baghdasaryan
From: Kent Overstreet These symbols are used to denote section boundaries: by always including them we can unify loading sections from modules with loading built-in sections, which leads to some significant cleanup. Signed-off-by: Kent Overstreet --- scripts/kallsyms.c | 13 + 1

[RFC PATCH 06/30] lib: code tagging module support

2022-08-30 Thread Suren Baghdasaryan
Add support for code tagging from dynamically loaded modules. Signed-off-by: Suren Baghdasaryan Co-developed-by: Kent Overstreet Signed-off-by: Kent Overstreet --- include/linux/codetag.h | 12 ++ kernel/module/main.c| 4 lib/codetag.c | 51

[RFC PATCH 05/30] lib: code tagging framework

2022-08-30 Thread Suren Baghdasaryan
Overstreet Signed-off-by: Suren Baghdasaryan --- include/linux/codetag.h | 71 ++ lib/Kconfig.debug | 4 + lib/Makefile| 1 + lib/codetag.c | 199 4 files changed, 275 insertions(+) create mode 100644 include/linux

[RFC PATCH 02/30] lib/string_helpers: Drop space in string_get_size's output

2022-08-30 Thread Suren Baghdasaryan
From: Kent Overstreet Previously, string_get_size() outputted a space between the number and the units, i.e. 9.88 MiB This changes it to 9.88MiB which allows it to be parsed correctly by the 'sort -h' command. Signed-off-by: Kent Overstreet Cc: Andy Shevchenko Cc: Michael Ellerman Cc:

[RFC PATCH 01/30] kernel/module: move find_kallsyms_symbol_value declaration

2022-08-30 Thread Suren Baghdasaryan
Allow find_kallsyms_symbol_value to be called by code outside of kernel/module. It will be used for code tagging module support. Signed-off-by: Suren Baghdasaryan --- include/linux/module.h | 1 + kernel/module/internal.h | 1 - 2 files changed, 1 insertion(+), 1 deletion(-) diff --git

[RFC PATCH 00/30] Code tagging framework and applications

2022-08-30 Thread Suren Baghdasaryan
e tagging based latency tracking Improved symbolic error names dyndbg: Convert to code tagging MAINTAINERS: Add entries for code tagging & related Suren Baghdasaryan (16): kernel/module: move find_kallsyms_symbol_value declaration lib: code tagging framework lib: code tagging m

[RFC PATCH 13/30] mm/slab: introduce SLAB_NO_OBJ_EXT to avoid obj_ext creation

2022-08-30 Thread Suren Baghdasaryan
these caches and avoid creating extensions for objects allocated from these slabs. Signed-off-by: Suren Baghdasaryan --- include/linux/slab.h | 7 +++ mm/slab.c| 2 +- mm/slub.c| 5 +++-- 3 files changed, 11 insertions(+), 3 deletions(-) diff --git a/include/linux/slab.h b

[RFC PATCH 07/30] lib: add support for allocation tagging

2022-08-30 Thread Suren Baghdasaryan
Introduce CONFIG_ALLOC_TAGGING which provides definitions to easily instrument allocators. It also registers an "alloc_tags" codetag type with defbugfs interface to output allocation tags information. Signed-off-by: Suren Baghdasaryan Co-developed-by: Kent Overstreet Signed-of

[RFC PATCH 03/30] Lazy percpu counters

2022-08-30 Thread Suren Baghdasaryan
From: Kent Overstreet This patch adds lib/lazy-percpu-counter.c, which implements counters that start out as atomics, but lazily switch to percpu mode if the update rate crosses some threshold (arbitrarily set at 256 per second). Signed-off-by: Kent Overstreet ---