[PATCH 0/7] printing: improve printcap update CPU usage

David Disseldorp ddiss at samba.org
Mon Aug 4 07:58:00 MDT 2014


This patch-set attempts to address bug 10652: Samba consumes a lot of
CPU when re-reading printcap info.

It does so with the following changes to the printcap update procedure:
- Use traverse_read for printer list share updates, instead of exclusive
  (write locked) traversals. This significantly reduces printer_list.tdb
  lock contention.
- As suggested by Volker, reload per-client smbd printer share
  inventories on client enumeration, rather than immediately after every
  printer list update.
  - If enumeration is requested but the printer list has not changed,
    then skip the printer share inventory update.
- Split delete_and_reload_printers() functionality into two functions
  such that per-client smbd processes do not perform registry.tdb
  updates or printer unpublishing. This is now only performed by the
  single process that performs the printer list update.

Feedback appreciated.

As a follow up to this patch-set, I plan to work on converting the
asynchronous printcap update procedure to use tevent for completion
callbacks.

Cheers, David

--

The following changes since commit fb9d8c402614556d7a36f9e9efb72b3f4afe838a:

  lib: Remove unused nstrcpy (2014-08-04 09:58:16 +0200)

are available in the git repository at:

  git://git.samba.org/ddiss/samba.git printer_list_traverse_read_when_changed_notrans_master

for you to fetch changes up to 0b823e038e1c807b2ff9f13256a4b1b7b33c7fbd:

  smbd: split printer reload processing (2014-08-04 14:11:21 +0200)

----------------------------------------------------------------
David Disseldorp (7):
      printing: traverse_read the printer list for share updates
      printing: only reload printer shares on client enum
      printing: reload printer_list.tdb from in memory list
      printing: remove pcap_cache_add()
      printing: return last change time with pcap_cache_loaded()
      smbd: only reprocess printer_list.tdb if it changed
      smbd: split printer reload processing

 source3/printing/load.c                     |  4 ++--
 source3/printing/pcap.c                     | 54 ++++++++++++++++++++++++++----------------------------
 source3/printing/pcap.h                     | 13 ++++++-------
 source3/printing/print_aix.c                | 17 ++++++++++++++---
 source3/printing/print_iprint.c             | 16 ++++++++++------
 source3/printing/print_standard.c           |  8 ++++++--
 source3/printing/print_svid.c               | 11 +++++++----
 source3/printing/printer_list.c             | 17 +++++++++++------
 source3/printing/printer_list.h             |  4 ++--
 source3/printing/queue_process.c            | 10 ++++++----
 source3/printing/spoolssd.c                 | 38 +++++++-------------------------------
 source3/rpc_server/spoolss/srv_spoolss_nt.c | 11 ++++++++++-
 source3/rpc_server/srvsvc/srv_srvsvc_nt.c   |  1 +
 source3/smbd/proto.h                        |  2 ++
 source3/smbd/server.c                       | 20 --------------------
 source3/smbd/server_reload.c                | 95 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++-----------
 16 files changed, 194 insertions(+), 127 deletions(-)



More information about the samba-technical mailing list