Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:91784 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 72154 invoked from network); 20 Mar 2016 04:29:15 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 20 Mar 2016 04:29:15 -0000 Authentication-Results: pb1.pair.com smtp.mail=rasmus@lerdorf.com; spf=pass; sender-id=pass Authentication-Results: pb1.pair.com header.from=rasmus@lerdorf.com; sender-id=pass Received-SPF: pass (pb1.pair.com: domain lerdorf.com designates 209.85.192.179 as permitted sender) X-PHP-List-Original-Sender: rasmus@lerdorf.com X-Host-Fingerprint: 209.85.192.179 mail-pf0-f179.google.com Received: from [209.85.192.179] ([209.85.192.179:34639] helo=mail-pf0-f179.google.com) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id 4B/42-48999-9172EE65 for ; Sat, 19 Mar 2016 23:29:14 -0500 Received: by mail-pf0-f179.google.com with SMTP id x3so222419132pfb.1 for ; Sat, 19 Mar 2016 21:29:13 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=lerdorf-com.20150623.gappssmtp.com; s=20150623; h=date:from:subject:to:message-id:mime-version; bh=mGCDpDE/B+m1xsy6v3jBtP5CMAto8J/dqRMcTbPXlNg=; b=X7jErPNPR9pWXESUsHFYju/b5ur2fRW7h7mmnU8JX/UjYeKhXgZElbYfWkIrp0q5Zx YxpE/5QwnseGRzHdpV3SoISd3jqMu56ELJGApukfNlt1oVOcTdr3ax2zpGUAFsD/jRa2 c1aeH4SbkZbPY1auNRbnxbqPNgjIvyvUMjCoE/Zujl7iqLn/5KzTSpWacbJZi/rsPn24 +xVuhaEiG+PmNB+FJC0pnCYV2IwTzxDqF/OGoKP0Yn4LVjlTGmRJBbPagit546jgroCn /G8YCNblr9TwU0mtNEgutP/fCnisB4XBu8Qs5LNjkigl+bCh8kcVo0ao6aB/kogdAB5P 3yXQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:date:from:subject:to:message-id:mime-version; bh=mGCDpDE/B+m1xsy6v3jBtP5CMAto8J/dqRMcTbPXlNg=; b=RYeIgJf4MZmAHH2s10Dc3eLihjFBsgjZNVi1eI6BPoCgVvQZESOjeRPtWj9CUfy9S9 Rs3p11ZuYHuYci0xDPFgC6pPh3g5wjQJL/X5ec+4+Du1lBGCDhvRyxcOfY51EHCAxfvL /jfnck8mh6/OXXnU+WNqYKSIGT3yg7/KTuoDhZflX+vqZxaDXTuyd5gTHYsLd/VA22v9 hEFq8aT8nhodSm95qEix3FrxdIwerTLIAOMkhgGN4uvqbq/lPFd4CH9/HW4WgNeZQxb8 08hSKIYkEQd6tW/m3ZofLoJHkqPJwxxiERnupLktNsCNRI5a+zDqLPS76a54/ouCWp+l tdGQ== X-Gm-Message-State: AD7BkJIbGTHTvRSNVROYLKwDYWz1D4x9bx/hc9wcmA5Zam18I4skNqyLMh1oi5hYVN66Gg== X-Received: by 10.98.14.147 with SMTP id 19mr6399332pfo.79.1458448151224; Sat, 19 Mar 2016 21:29:11 -0700 (PDT) Received: from debian ([2601:647:4802:1669:ad59:c764:b845:7a24]) by smtp.gmail.com with ESMTPSA id m87sm31137942pfj.38.2016.03.19.21.29.08 for (version=TLSv1/SSLv3 cipher=OTHER); Sat, 19 Mar 2016 21:29:09 -0700 (PDT) Date: Sat, 19 Mar 2016 21:29:06 -0700 To: php-internals Message-ID: <1458448146.14007.1@smtp.gmail.com> X-Mailer: geary/0.10.0 MIME-Version: 1.0 Content-Type: multipart/alternative; boundary="=-SbQ64CtGbuTp3d8QNc5u" Subject: Huge Pages From: rasmus@lerdorf.com (Rasmus) --=-SbQ64CtGbuTp3d8QNc5u Content-Type: text/plain; charset=utf-8; format=flowed We have a bit of a problem with how Linux handles huge pages when you run out of them. I've been discussing it with Dmitry and he recently committed a way to disable Huge Pages in the main allocator to master: https://github.com/php/php-src/commit/945a661912612cdecd221cd126feda7d4335c33c Unfortunately it looks like Linux is very unhappy when a CoW happens to a huge page allocated in its parent process and it tries to re-map this page. If there are no available huge pages you get random seg faults/bus errors and everything blows up. I don't understand why Linux can't fall back to a regular page here in this case, but it doesn't. It seems like an OS bug to me, but nonetheless this affects mod_php/php-fpm since we have a huge page allocated before the fork, but it also affects any cli script that does a pcntl_fork(). As far as I can tell there is no way to fix it. We could try to make sure we never do a MAP_HUGETLB prior to the fork in mod_php/php-fpm but that still doesn't solve the pcntl_fork() case. Anatol, we should merge Dmitry's patch into PHP-7.0 and further, I think we should flip the default to zend_mm_use_huge_pages = 0 in it. If you have well-behaved code that never tries to allocate a lot of memory you can turn on huge pages, but I think we should default to safety here. Those SIGBUS storms are quite alarming and hard to figure out. There have also been some other issues with huge pages as per these bugs: https://bugs.php.net/70984 https://bugs.php.net/71272 https://bugs.php.net/71355 This is very much an expert feature that we need to document better and people should know what they are stepping in when they turn this feature on. -Rasmus --=-SbQ64CtGbuTp3d8QNc5u--