Skip to contentSkip to conversation

tracing: fix event_subsystem ref counting

PATCH In review Ilya Dryomov 3 participants 6 messages Oct 31, 2011 – Dec 6, 2011 Tracing

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 tracing: fix event_subsystem ref counting

Fix a bug introduced by e9dbfae5, which prevents event_subsystem from ever being released.

Ref_count was added to keep track of subsystem users, not for counting events. Subsystem is created with ref_count = 1, so there is no need to increment it for every event, we have nr_events for that. Fix this by touching ref_count only when we actually have a new user - subsystem_open().

---
 kernel/trace/trace_events.c |    1 -
 1 files changed, 0 insertions(+), 1 deletions(-)
kernel/trace/trace_events.c +0 -1
index 581876f..c212a7f 100644
@@ -1078,7 +1078,6 @@ event_subsystem_dir(const char *name, struct dentry *d_events)
 	/* First see if we did not already create this dir */
 	list_for_each_entry(system, &event_subsystems, list) {
 		if (strcmp(system->name, name) == 0) {
-			__get_system(system);
 			system->nr_events++;
 			return system->entry;
 		}
Signature · 1 line
1.7.6.3
maintainer
#1 lore raw
Quoted 8 lines · Ilya Dryomov

Fix a bug introduced by e9dbfae5, which prevents event_subsystem from ever being released.

Ref_count was added to keep track of subsystem users, not for counting events. Subsystem is created with ref_count = 1, so there is no need to increment it for every event, we have nr_events for that. Fix this by touching ref_count only when we actually have a new user - subsystem_open().

Good catch, I'll pull this in.

Thanks!

-- Steve

Quoted 18 lines
---
 kernel/trace/trace_events.c |    1 -
 1 files changed, 0 insertions(+), 1 deletions(-)
kernel/trace/trace_events.c +0 -1
index 581876f..c212a7f 100644
@@ -1078,7 +1078,6 @@ event_subsystem_dir(const char *name, struct dentry *d_events)
 	/* First see if we did not already create this dir */
 	list_for_each_entry(system, &event_subsystems, list) {
 		if (strcmp(system->name, name) == 0) {
-			__get_system(system);
 			system->nr_events++;
 			return system->entry;
 		}
#2 lore raw
Quoted 4 lines · Steven Rostedt
Quoted 3 lines · Ilya Dryomov

Fix a bug introduced by e9dbfae5, which prevents event_subsystem from ever being released.

Quoted 8 lines
Quoted 5 lines

Ref_count was added to keep track of subsystem users, not for counting events. Subsystem is created with ref_count = 1, so there is no need to increment it for every event, we have nr_events for that. Fix this by touching ref_count only when we actually have a new user - subsystem_open().

Good catch, I'll pull this in.

I made a different fix last week:

http://marc.info/?l=linux-kernel&m=131978486911595&w=2

but I guess Ilya's version is a bit better.

maintainer
#3 lore raw
Quoted 11 lines · Li Zefan
Quoted 10 lines · Steven Rostedt
Quoted 8 lines · Ilya Dryomov

Fix a bug introduced by e9dbfae5, which prevents event_subsystem from ever being released.

Ref_count was added to keep track of subsystem users, not for counting events. Subsystem is created with ref_count = 1, so there is no need to increment it for every event, we have nr_events for that. Fix this by touching ref_count only when we actually have a new user - subsystem_open().

Quoted 8 lines
Quoted 2 lines

Good catch, I'll pull this in.

I made a different fix last week:

http://marc.info/?l=linux-kernel&m=131978486911595&w=2

but I guess Ilya's version is a bit better.

That patch was still in my queue to process, as I missed it during my travels to Prague. But yeah, I think Ilya's patch is a better solution.

Thanks!

-- Steve

#4 lore raw
In reply to Ilya Dryomov
Commit-ID:  d631097577f6fe027f4903f62eabced6445d19bf
Gitweb:     http://git.kernel.org/tip/d631097577f6fe027f4903f62eabced6445d19bf
Author:     Ilya Dryomov <[email protected]>
AuthorDate: Mon, 31 Oct 2011 11:07:42 +0200
Committer:  Steven Rostedt <[email protected]>
CommitDate: Mon, 31 Oct 2011 13:59:23 -0400

tracing: fix event_subsystem ref counting

Fix a bug introduced by e9dbfae5, which prevents event_subsystem from ever being released.

Ref_count was added to keep track of subsystem users, not for counting events. Subsystem is created with ref_count = 1, so there is no need to increment it for every event, we have nr_events for that. Fix this by touching ref_count only when we actually have a new user - subsystem_open().

---
 kernel/trace/trace_events.c |    1 -
 1 files changed, 0 insertions(+), 1 deletions(-)
kernel/trace/trace_events.c +0 -1
index 581876f..c212a7f 100644
@@ -1078,7 +1078,6 @@ event_subsystem_dir(const char *name, struct dentry *d_events)
 	/* First see if we did not already create this dir */
 	list_for_each_entry(system, &event_subsystems, list) {
 		if (strcmp(system->name, name) == 0) {
-			__get_system(system);
 			system->nr_events++;
 			return system->entry;
 		}
#5 lore raw
In reply to Ilya Dryomov
Commit-ID:  cb59974742aea24adf6637eb0c4b8e7b48bca6fb
Gitweb:     http://git.kernel.org/tip/cb59974742aea24adf6637eb0c4b8e7b48bca6fb
Author:     Ilya Dryomov <[email protected]>
AuthorDate: Mon, 31 Oct 2011 11:07:42 +0200
Committer:  Steven Rostedt <[email protected]>
CommitDate: Mon, 5 Dec 2011 13:28:44 -0500

tracing: fix event_subsystem ref counting

Fix a bug introduced by e9dbfae5, which prevents event_subsystem from ever being released.

Ref_count was added to keep track of subsystem users, not for counting events. Subsystem is created with ref_count = 1, so there is no need to increment it for every event, we have nr_events for that. Fix this by touching ref_count only when we actually have a new user - subsystem_open().

---
 kernel/trace/trace_events.c |    1 -
 1 files changed, 0 insertions(+), 1 deletions(-)
kernel/trace/trace_events.c +0 -1
index 581876f..c212a7f 100644
@@ -1078,7 +1078,6 @@ event_subsystem_dir(const char *name, struct dentry *d_events)
 	/* First see if we did not already create this dir */
 	list_for_each_entry(system, &event_subsystems, list) {
 		if (strcmp(system->name, name) == 0) {
-			__get_system(system);
 			system->nr_events++;
 			return system->entry;
 		}