Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:46070 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 74243 invoked from network); 17 Nov 2009 13:34:58 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 17 Nov 2009 13:34:58 -0000 Authentication-Results: pb1.pair.com header.from=yoarvi@gmail.com; sender-id=pass; domainkeys=bad Authentication-Results: pb1.pair.com smtp.mail=yoarvi@gmail.com; spf=pass; sender-id=pass Received-SPF: pass (pb1.pair.com: domain gmail.com designates 209.85.216.186 as permitted sender) DomainKey-Status: bad X-DomainKeys: Ecelerity dk_validate implementing draft-delany-domainkeys-base-01 X-PHP-List-Original-Sender: yoarvi@gmail.com X-Host-Fingerprint: 209.85.216.186 mail-px0-f186.google.com Received: from [209.85.216.186] ([209.85.216.186:57090] helo=mail-px0-f186.google.com) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id 2A/64-50228-186A20B4 for ; Tue, 17 Nov 2009 08:34:57 -0500 Received: by pxi16 with SMTP id 16so4574347pxi.29 for ; Tue, 17 Nov 2009 05:34:54 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:mime-version:received:date:message-id:subject :from:to:content-type; bh=hgrYIsKxjsmq4dBIJwXdsQ1Xcp5f1kljqSisxAyQNhs=; b=X4nnv45UvJkqgq3BvZ34Oa+JoHvJ8ozme/72eh5PfYUOIu1PHJbQqpF65woaEX6O6R rZTpUIVHR2R1e7O3OzJQrSd8VtZv739LQyhR/Xgb5nFsF4G5On5srdAUsAjz5l61ioAe etdqMWqY9aTjthMW7wb3ANxu3Nykwk+b0BEXo= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=mime-version:date:message-id:subject:from:to:content-type; b=MyqWWTWSQKT+423ZbF443g2T0TvHdZ2r7tYDQCgJokrK4vbou6Ec9e75uj8S1GKMLi dairKRLUwdPaMN4WyBcE+3NsakNNxOJry8HNNZ2KQjDM/19ipDlMNakjVTvCK4tdHlJj xpj/6HGH2D+kSJbNW5ze2XU1yrnlSA0xsdLYE= MIME-Version: 1.0 Received: by 10.142.8.34 with SMTP id 34mr1000925wfh.103.1258464894909; Tue, 17 Nov 2009 05:34:54 -0800 (PST) Date: Tue, 17 Nov 2009 19:04:54 +0530 Message-ID: To: internals@lists.php.net Content-Type: text/plain; charset=ISO-8859-1 Subject: [PATCH] - Improving multi-threaded scalability by using emalloc/efree/estrdup instead of malloc/free/strdup in virtual_cwd APIs From: yoarvi@gmail.com (Arvind Srinivasan) Using malloc/free in a multi-threaded process limits its scalability because of the process-wide lock inside malloc/free. The scalability of the PHP engine in a multi-threaded process can be improved by reducing the use of malloc/free/strdup and instead using emalloc/efree/estrdup wherever possible (at least in the main request processing code paths). The code paths in TSRM/tsrm_virtual_cwd.c are invoked quite frequently and they use malloc/free/strdup. I'd like to submit the following patches (based on the PHP6 source tree) for review that incorporate the use of emalloc/efree/estrdup in the virtual_cwd code paths. In order to use emalloc/efree I had to relocate tsrm_virtual_cwd.c from the TSRM directory to the Zend directory. I've split the change into 3 patches in order to make the changes easy to see Avoid name clash between global and local variable (http://bugs.php.net/bug.php?id=50101) http://bitbucket.org/arvi/arviq/src/tip/arvi-08-namespace Rename TSRM/tsrm_virtual_cwd.[ch] to Zend/zend_virtual_cwd.[ch] http://bitbucket.org/arvi/arviq/src/tip/arvi-08-virtual_cwd Replace malloc/free/strdup with emalloc/efree/estrdup http://bitbucket.org/arvi/arviq/src/tip/arvi-08-virtual_cwd-emalloc Thanks, Arvi