Newsgroups: php.cvs,php.internals Path: news.php.net Xref: news.php.net php.cvs:82024 php.internals:77727 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 98829 invoked from network); 30 Sep 2014 22:09:30 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 30 Sep 2014 22:09:30 -0000 Authentication-Results: pb1.pair.com smtp.mail=dmitry@zend.com; spf=pass; sender-id=pass Authentication-Results: pb1.pair.com header.from=dmitry@zend.com; sender-id=pass Received-SPF: pass (pb1.pair.com: domain zend.com designates 209.85.220.174 as permitted sender) X-PHP-List-Original-Sender: dmitry@zend.com X-Host-Fingerprint: 209.85.220.174 mail-vc0-f174.google.com Received: from [209.85.220.174] ([209.85.220.174:43138] helo=mail-vc0-f174.google.com) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id 0E/50-30671-81A2B245 for ; Tue, 30 Sep 2014 18:09:30 -0400 Received: by mail-vc0-f174.google.com with SMTP id hq12so340009vcb.33 for ; Tue, 30 Sep 2014 15:09:25 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:mime-version:in-reply-to:references:date :message-id:subject:from:to:cc:content-type; bh=8pJwFlEt5aHGiwJ05EsGwI7w+ZOwebtbHe7WskwKeSQ=; b=L/bZT71ykOhHwq5wIXU0k7CzdkSYiqNFjiLSSSAExjy2xeOmJoXxQ0P/AHvheMr+p9 dn8S5kIKrYSm8blud0wk52DtiLtxV8u6ZVhUQFDVC499HsijkhF2IG522/VYaEMoiJDn al9eATMsw4mMNCRHAGMD7PjUAI8Tu9JrvDqHWRGs+LtSdmq5t1ExEAztvLZ4+I3j5kTO sc/hBbdoY8NBFc/neuhci06X+E93vVwhD0QpJG6u7MDKZfqSlt2wPkkY4eG1cWhkSQvC y5MsSMHz6bC5QrPOpuEII2UhkAS96daq7F+CcLT9p8MkS1xY6zNtMa0PefCcKo2hQe8Z iAPQ== X-Gm-Message-State: ALoCoQl4Uk9HKqXbqGHqdz/GzL37jmffzbWAlC+SDCkfiycOx0SNU4NaNJUucVDBI8j6xnidWUX4r1zzpxAJ6fuVimXfWkglcJ/r5i/rSg3JVOVFCi9SZFeh8sjUAQ23Sm6QsVl2fbJyRKdnuMXwEDyfKGImhfWTLw== MIME-Version: 1.0 X-Received: by 10.52.231.228 with SMTP id tj4mr31912371vdc.28.1412114965337; Tue, 30 Sep 2014 15:09:25 -0700 (PDT) Received: by 10.52.158.197 with HTTP; Tue, 30 Sep 2014 15:09:25 -0700 (PDT) In-Reply-To: References: <35865ab5a49aa7711727174e173d0723.squirrel@webmail.klapt.com> <57df99a6abdfeeb9036b529fb83175bd.squirrel@webmail.klapt.com> Date: Wed, 1 Oct 2014 02:09:25 +0400 Message-ID: To: Anatol Belski , Joe Watkins Cc: Anatol Belski , Nikita Popov , "php-cvs@lists.php.net" , PHP Internals , Pierre Joye , Xinchen Hui Content-Type: multipart/alternative; boundary=089e0111b0a2e42ab605044fa287 Subject: Re: [PHP-DEV] Re: [PHP-CVS] com php-src: fix CG(empty_string) init in ZTS: Zend/zend.c From: dmitry@zend.com (Dmitry Stogov) --089e0111b0a2e42ab605044fa287 Content-Type: text/plain; charset=UTF-8 Hi, I took a quick look over the patch. I didn't get why it's named "native_tls" now, because it doesn't use "__thread" variables anymore. Actually, now the patch get rid of additional TSRMLS_ arguments, but performs near the same thing as TSRMLS_FETCH() on each module global access. It leads to huge slowdown. bench.php. non-zts: 1.222 sec zts: 1.362 sec native_tls: 1.785 sec I think, the patch makes no sense in this state. It looks like on Windows we can't use __declspec(thread) in DLLs loaded using LoadLibray() at all, so we won't ale to build mod_php for Apache or use __declspec(thread) for module globals of extensions build as DLL On Linux it must be possible, but it depends on TLS model (gcc -ftls-model=...). "global-dynamic" model must work in all cases, but I'm not sure about performance, because it'll lead to additional function call for each "__thread" variable access (may be I'm wrong). Better models (like "initial-exec") have some limitations. I don't have enough experience to say, if they could work for us. Thanks. Dmitry. On Mon, Sep 29, 2014 at 10:54 AM, Dmitry Stogov wrote: > Hi Anatol. > > I'll take a look on Tuesday or Wednesday. > > Thanks. Dmitry. > > On Sat, Sep 27, 2014 at 12:59 AM, Anatol Belski > wrote: > >> Hi Dmitry, >> >> On Mon, September 22, 2014 08:43, Dmitry Stogov wrote: >> > Hi Anatol, >> > >> > >> > I didn't completely get your ideas, but if tsrm_ls_cache can't be >> > exported on Windows directly, can we have a copy of tsrm_ls_cache in >> each >> > DLL/EXE >> > and initialize it once? >> > >> > Thanks. Dmitry. >> > >> Joe and me was working on this and there is a worky version now. Generally >> it suffers from some issues already present in master, but in all things >> together it's a worky crossplatform approach. Please look up the >> native-tls branch. >> >> For the current variant I used the idea from the original RFC, but removed >> exporting the TSRM cache through a __thread variable as it's not portable. >> I've also removed the offset logic from the RFC patch, as that brought >> additional hard to find bugs especially into the current unstable version. >> I don't think it's necessary to copy the arbitrary globals structs in >> every ext, further more i think it's not easy possible without some big >> overhead. However even with the current native-tls branch I'm able to run >> wordpress, symfony, ab -c 8 -n 2048 pass also with multiple calls. Still, >> some Apache bugs are already reported against master, I also repro some >> others, mostly arbitrary shutdown crashes in Apache (so TS version). So as >> they're in master, they're for sure in native-tls. >> >> PHP happens to always have used TLS, however the pointer was passed >> directly to the functions. In TSRM.c, that's tsrm_tls_get/tsrm_tls_set. >> Now, a function wrapper is used to fetch the TLS cache directly in the >> TSRMG macro. This makes the whole slowlier, but allows to get rid of the >> TSRMLS_* macros. The big question is to optimize the function call to >> speedup the whole. Maybe one can speedup it saving a tsrm ls cache pointer >> locally per extension or code area. ATM we're checking the functional >> part, then one can proceed further with removing the TSRMLS_* macros. Any >> speedup or improvement thoughts are welcome. >> >> Possible directions of the further work after known bugs are fixed (in >> master or in native-tls), some are mutually exclusive >> >> - reimplement the offset logic instead of arrays for the globals structs >> - share the tsrm cache pointer globally to some scope, like extension or >> sapi >> - remove the linked lists logic and use TLS explicitly >> - improve locking >> >> Thanks >> >> Anatol >> >> > --089e0111b0a2e42ab605044fa287--