From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-0.8 required=3.0 tests=DKIM_SIGNED,DKIM_VALID, HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS autolearn=no autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 384D4C2BA2B for ; Thu, 16 Apr 2020 22:12:43 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id EADE9218AC for ; Thu, 16 Apr 2020 22:12:42 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=shutemov-name.20150623.gappssmtp.com header.i=@shutemov-name.20150623.gappssmtp.com header.b="fcE8vIY8" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org EADE9218AC Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=shutemov.name Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=owner-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix) id 888568E00F1; Thu, 16 Apr 2020 18:12:42 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 8394A8E00E7; Thu, 16 Apr 2020 18:12:42 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 74E408E00F1; Thu, 16 Apr 2020 18:12:42 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0147.hostedemail.com [216.40.44.147]) by kanga.kvack.org (Postfix) with ESMTP id 57BCF8E00E7 for ; Thu, 16 Apr 2020 18:12:42 -0400 (EDT) Received: from smtpin14.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay03.hostedemail.com (Postfix) with ESMTP id 181CA824559C for ; Thu, 16 Apr 2020 22:12:42 +0000 (UTC) X-FDA: 76715118564.14.joke41_1786369eb3b23 X-HE-Tag: joke41_1786369eb3b23 X-Filterd-Recvd-Size: 4651 Received: from mail-lf1-f67.google.com (mail-lf1-f67.google.com [209.85.167.67]) by imf13.hostedemail.com (Postfix) with ESMTP for ; Thu, 16 Apr 2020 22:12:41 +0000 (UTC) Received: by mail-lf1-f67.google.com with SMTP id 198so90054lfo.7 for ; Thu, 16 Apr 2020 15:12:41 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=shutemov-name.20150623.gappssmtp.com; s=20150623; h=date:from:to:cc:subject:message-id:references:mime-version :content-disposition:in-reply-to; bh=sZgj1ZrAXOwHlYXwg4Ycg+watpXpPbWmk7DvmzwiL7Q=; b=fcE8vIY8L6o7x6PldEOOEQPNtQTjivyAw3L2B4x4MzMl9Tg2VzAG3xdaKSISAHU6va wPR0onErB0FkjoXPoFyUMxrVZO4+ZHvqVxQIBHyM/8KiymM0OsM96Tos6mcZUEAPqMj2 GgPbDLhcZmqiCUlTN34qY9K7TZKZGd7NXEZ3QY1ZsJ7xbhPkPPYrvcmNia8gJqhjhHQw Q0mtrkIJwfLN0MiinnIMkRREvaiKFQ5OiZhU5eoq8ztZeFqkxvlMFCnDeoIyrCuEB7Vo LNFLwL7vJYoFmaElmf5XXx0XEI5Qs26St3CA8r4t7+W8NidsFOcbIiFme2IMlLnLe77W S1rQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:in-reply-to; bh=sZgj1ZrAXOwHlYXwg4Ycg+watpXpPbWmk7DvmzwiL7Q=; b=H7o/DbdhqwGqOIbhGRLDqFhtgN3HimofkqXQPMyxsxCbfHRAUTXUoAaHLk1Vuv++pS CHLsWuNQ0Z+3Hh8uudFoShoI6iT9bmCMP+b5BbvYiH2Mfdx5hbrcLPhMEuFYnYv4y1qi X7vGBdYGOITE2CsytbqfQQfm/2yjuELL0fanflAmzJNRPD15/GDLs5tMaMFz3FJ2H9aX cxYqeDOcpP5i8ZRINOCZmQ6/+wcx5PSA1MOogOfBnDZKjkk6U8CV3otq6w25c7DukXGX yFUxi5D/m1ytUSEgZ9CNZpjF9LxGCr6rCHO2g9Kk8DNzc+WENIgwqVEyJ/SAtA7ixzi8 YpjA== X-Gm-Message-State: AGi0PuaY4SaCQQcE1gg2ZRpQGNouK3fmwFnF+vxrV4k6lpsyU8ztCiTb KQ0DklcE/NthnxHrDBjazKBR2w== X-Google-Smtp-Source: APiQypJupD5xGPoTaxQXKBQ5fQv+cLHXCuBt2Nbg5dUyDPftkhL/VpApq64jbgk26cIddcN8vWWpYg== X-Received: by 2002:a19:550a:: with SMTP id n10mr7367lfe.143.1587075159959; Thu, 16 Apr 2020 15:12:39 -0700 (PDT) Received: from box.localdomain ([86.57.175.117]) by smtp.gmail.com with ESMTPSA id b9sm19480499lfp.27.2020.04.16.15.12.38 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 16 Apr 2020 15:12:38 -0700 (PDT) Received: by box.localdomain (Postfix, from userid 1000) id D52C3102EA9; Fri, 17 Apr 2020 01:12:38 +0300 (+03) Date: Fri, 17 Apr 2020 01:12:38 +0300 From: "Kirill A. Shutemov" To: Dave Hansen Cc: "Kirill A. Shutemov" , Andy Lutomirski , Peter Zijlstra , Thomas Gleixner , Ingo Molnar , Borislav Petkov , "H. Peter Anvin" , x86@kernel.org, linux-mm@kvack.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH, RFC] x86/mm/pat: Restore large pages after fragmentation Message-ID: <20200416221238.qrkaajbe3m6ca2h2@box> References: <20200416213229.19174-1-kirill.shutemov@linux.intel.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: X-Bogosity: Ham, tests=bogofilter, spamicity=0.000000, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: On Thu, Apr 16, 2020 at 03:03:12PM -0700, Dave Hansen wrote: > On 4/16/20 2:32 PM, Kirill A. Shutemov wrote: > > With current code it's one way road: kernel tries to avoid splitting > > large pages, but it doesn't restore them back even if page attributes > > got compatible again. > > Looks pretty sane to me, and sounds like something we've needed for a > long time. > > I'd having doubts in my ability to find nasty corner cases in this code, > though. Could you rig up some tests to poke at this thing further? Maybe: > > Record what the direct map looks like (even from userspace). Then, > allocate some memory, including odd-sized and aligned ranges. Try to do > things >4M like the hugetlbfs code does. Make the allocation (or a > piece of it) not-present (or whatever), which usually fractures some > large pages. Then put it back the way it was. All the large pages > should come back. > > If it survives that for an hour or two, it should be pretty good to go. > Basically, fuzz it. We already have it in kernel: CONFIG_CPA_DEBUG. It messes up with the mapping every 30 seconds. It is pretty good for the change too. It produces a lot of 2M/1G pages to be restored. I run it over night in my setup and it survives. -- Kirill A. Shutemov