Sign Up
Log In
Log In
or
Sign Up
Places
All Projects
Status Monitor
Collapse sidebar
SUSE:SLE-12-SP5:Update
xen.5424
xs-06-talloc-report.patch
Overview
Repositories
Revisions
Requests
Users
Attributes
Meta
File xs-06-talloc-report.patch of Package xen.5424
commit 4a6ddd21d9850eca30776aa8bf308061ff01f8e6 Author: Juergen Gross <jgross@suse.com> Date: Tue Jul 19 14:08:18 2016 +0200 xenstore: add memory allocation debugging capability Add support for debugging memory allocation statistics to xenstored. Specifying "-M <file>" on the command line will enable the feature. Whenever xenstored receives SIGUSR1 it will dump out a full talloc report to <file>. This helps finding e.g. memory leaks in xenstored. Signed-off-by: Juergen Gross <jgross@suse.com> Acked-by: Ian Jackson <ian.jackson@eu.citrix.com> Index: xen-4.5.5-testing/tools/xenstore/xenstored_core.c =================================================================== --- xen-4.5.5-testing.orig/tools/xenstore/xenstored_core.c +++ xen-4.5.5-testing/tools/xenstore/xenstored_core.c @@ -82,6 +82,7 @@ static int reopen_log_pipe[2]; static int reopen_log_pipe0_pollfd_idx = -1; static char *tracefile = NULL; static TDB_CONTEXT *tdb_ctx = NULL; +static bool trigger_talloc_report = false; static void corrupt(struct connection *conn, const char *fmt, ...); static void check_store(void); @@ -1792,6 +1793,10 @@ static void init_sockets(int **psock, in static int minus_one = -1; *psock = *pro_sock = &minus_one; } + +static void do_talloc_report(int sig) +{ +} #else static int destroy_fd(void *_fd) { @@ -1916,6 +1921,11 @@ static void init_sockets(int **psock, in } + +static void do_talloc_report(int sig) +{ + trigger_talloc_report = true; +} #endif static void usage(void) @@ -1941,6 +1951,7 @@ static void usage(void) " the store is corrupted (debug only),\n" " --internal-db store database in memory, not on disk\n" " --preserve-local to request that /local is preserved on start-up,\n" +" --memory-debug <file> support memory debugging to file,\n" " --verbose to request verbose execution.\n"); } @@ -1963,6 +1974,7 @@ static struct option options[] = { { "internal-db", 0, NULL, 'I' }, { "verbose", 0, NULL, 'V' }, { "watch-nb", 1, NULL, 'W' }, + { "memory-debug", 1, NULL, 'M' }, { NULL, 0, NULL, 0 } }; extern void dump_conn(struct connection *conn); @@ -1978,9 +1990,10 @@ int main(int argc, char *argv[]) bool outputpid = false; bool no_domain_init = false; const char *pidfile = NULL; + const char *memfile = NULL; int timeout; - while ((opt = getopt_long(argc, argv, "DE:F:HNPS:t:T:RLVW:", options, + while ((opt = getopt_long(argc, argv, "DE:F:HNPS:t:T:RLVW:M:", options, NULL)) != -1) { switch (opt) { case 'D': @@ -2034,6 +2047,9 @@ int main(int argc, char *argv[]) case 'p': priv_domid = strtol(optarg, NULL, 10); break; + case 'M': + memfile = optarg; + break; } } if (optind != argc) @@ -2069,6 +2085,11 @@ int main(int argc, char *argv[]) /* Don't kill us with SIGPIPE. */ signal(SIGPIPE, SIG_IGN); + if (memfile) { + talloc_enable_null_tracking(); + signal(SIGUSR1, do_talloc_report); + } + #if defined(XEN_SYSTEMD_ENABLED) if (sd_booted()) xen_claim_active_sockets(&sock, &ro_sock); @@ -2117,6 +2138,17 @@ int main(int argc, char *argv[]) for (;;) { struct connection *conn, *next; + if (trigger_talloc_report) { + FILE *out; + + trigger_talloc_report = false; + out = fopen(memfile, "a"); + if (out) { + talloc_report_full(NULL, out); + fclose(out); + } + } + if (poll(fds, nr_fds, timeout) < 0) { if (errno == EINTR) continue;
Locations
Projects
Search
Status Monitor
Help
OpenBuildService.org
Documentation
API Documentation
Code of Conduct
Contact
Support
@OBShq
Terms
openSUSE Build Service is sponsored by
The Open Build Service is an
openSUSE project
.
Sign Up
Log In
Places
Places
All Projects
Status Monitor