Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:91796 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 33467 invoked from network); 20 Mar 2016 22:09:46 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 20 Mar 2016 22:09:46 -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.180 as permitted sender) X-PHP-List-Original-Sender: rasmus@lerdorf.com X-Host-Fingerprint: 209.85.192.180 mail-pf0-f180.google.com Received: from [209.85.192.180] ([209.85.192.180:35263] helo=mail-pf0-f180.google.com) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id 70/8A-48999-9AF1FE65 for ; Sun, 20 Mar 2016 17:09:45 -0500 Received: by mail-pf0-f180.google.com with SMTP id n5so241111984pfn.2 for ; Sun, 20 Mar 2016 15:09:44 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=lerdorf-com.20150623.gappssmtp.com; s=20150623; h=subject:to:references:cc:from:message-id:date:user-agent :mime-version:in-reply-to:content-transfer-encoding; bh=u08TCpWygWOYOtW2HN3dSMhQlYgtwzk2rJ4wdXejBdA=; b=V5ETdBB+T0EeKpDL2vBRpThwjGnBYZlj9/FxXciBI44ZMGIKPN/85j1RqnmdQLQgDE udoFq4mJ+vQ3gEbkA56v10r0O5c3WYpz4SufTeUyv+UxGLQZH8IF67hA1Din8w8kJTIl kPbdbsDnIffLix3LkETbMGdKZ/kvegDRmb8do5cdRxkhGROa6i954uV4OT6gB0sgS0lv WFrigjBIqgllKNVzh81bQeFO6h9Sj3jfDvDtKL3v5P4wipvzUnSbp4v8u9ZzdkcPZtIp bmPfrtZr5OoJF2/mvWt72pA53qPczzuOjr7lX1N6o5dmAUG2KLFN0oGV+Mdp7qOkgOqn MIHw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:subject:to:references:cc:from:message-id:date :user-agent:mime-version:in-reply-to:content-transfer-encoding; bh=u08TCpWygWOYOtW2HN3dSMhQlYgtwzk2rJ4wdXejBdA=; b=F8WBeKGUQ8+auCcc+Huj/V/qLJqk1+SL7dQyvaoHQoKukXNNHKgWWEgsdfmOg4KIth mmzzttQZj71AWxh5eb4cKBKn0tV/HtOO+/SK0aiQXY2mPvlJby33SxMccK1g5liLk/F2 +3ITLAwkBvX256Z8qvyYEgR+13KjihLOAtHjFzgh596wcf97XOXJbzfapNobQGtPo8V+ BBK7xYP3VBa603cd+MCobOqbIx7mT7St1BF1NH/NKAFbIP3uODYGrZy9m77K9P7VcL5Z l+DCxCfgL42kqGYmtuMXEfeRGptvpH8BNvAgbuyyoglFRe5JfEvg24QqFlN0ULT9IqPQ 2oJg== X-Gm-Message-State: AD7BkJLdwnO9C1rlpnciMqooclhnNlHSh/s1agJ/QqjesTLXvmNaphUGtCsMm2io3uTo/g== X-Received: by 10.98.72.16 with SMTP id v16mr3172101pfa.5.1458511781892; Sun, 20 Mar 2016 15:09:41 -0700 (PDT) Received: from ?IPv6:2601:647:4802:1669:15aa:ed3e:f611:51ed? ([2601:647:4802:1669:15aa:ed3e:f611:51ed]) by smtp.gmail.com with ESMTPSA id f65sm35484727pfd.47.2016.03.20.15.09.39 (version=TLSv1/SSLv3 cipher=OTHER); Sun, 20 Mar 2016 15:09:40 -0700 (PDT) To: Anatol Belski , 'php-internals' References: <1458448146.14007.1@smtp.gmail.com> <097c01d182eb$33437780$99ca6680$@belski.net> Cc: 'Remi Collet' , 'Dmitry Stogov' Message-ID: <56EF1FA3.9060600@lerdorf.com> Date: Sun, 20 Mar 2016 15:09:39 -0700 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:38.0) Gecko/20100101 Thunderbird/38.7.0 MIME-Version: 1.0 In-Reply-To: <097c01d182eb$33437780$99ca6680$@belski.net> Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit Subject: Re: [PHP-DEV] Huge Pages From: rasmus@lerdorf.com (Rasmus Lerdorf) On 03/20/2016 01:58 PM, Anatol Belski wrote: > Dmitry has already merged this patch into the 7.0 branch. I also know from Remi that Fedora doesn't play well with the huge pages. Huge pages require special system settings which are usually not enabled in OSes by default. Having it off by default in PHP would therefore not cause any functional disadvantage while addressing the stability concerns. Thus reversing the default setting sounds feasible, it could be already done for the upcoming 7.0.5 if there are no objections. Yes, and since the special system settings, namely setting vm.nr_hugepages is a system-wide shared setting and not PHP-specific it makes even more sense to not enable huge pages by default. If you happen to install PHP on a system that has vm.nr_hugepages set to non-zero for some other service on that machine, PHP is going blow up as soon as it runs out of huge pages. And the 2nd reason to disable huge pages by default is that, as you say, on most systems vm.nr_hugepages is going to be 0 but MAP_HUGETLB will be defined because every modern OS supports huge pages even if they are not actually enabled. But the allocator doesn't know that. It will try to do a MAP_HUGETLB mmap every single time here: https://github.com/php/php-src/blob/master/Zend/zend_alloc.c#L470 which is going to fail with an ENOMEM error and fall back to a non-HUGETLB mmap. So every alloc there incurs an extra syscall in the default case. So we have 3 things to do: 1. Default it to off 2. Provide a way to specify the huge page size as per bug 71355 3. Document the use of USE_ZEND_ALLOC_HUGE_PAGES and how to set vm.nr_hugepages appropriately along with a warning about what might happen if don't allocate enough 1 and 3 are trivial. 2 is a little trickier if we want to try to detect the page size. We could just not try and let the user specify it. Perhaps even use ZEND_ALLOC_HUGE_PAGES directly. As in: ZEND_ALLOC_HUGE_PAGES=2048 would turn on huge pages in the allocator with 2k pages. -Rasmus