Received: by 2002:ad5:474a:0:0:0:0:0 with SMTP id i10csp4723091imu; Tue, 25 Dec 2018 07:45:11 -0800 (PST) X-Google-Smtp-Source: ALg8bN6WAUvvfmQ/O1DOry8xpJ/WoaxLW2/waDucDYiOfVp1iTQlePsT6dIzox0UEWlzQKUrE0am X-Received: by 2002:a63:b34f:: with SMTP id x15mr16176719pgt.243.1545752711200; Tue, 25 Dec 2018 07:45:11 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1545752711; cv=none; d=google.com; s=arc-20160816; b=Pb2zJiei8yo7ptxP+2FpJxpUar9jo2THRoRKR/vePYPsWc+ohXbXcekGc8/2/g6nXr jQ2y71Ymz9Ydwp2iYzZaU2/CSj7T8fG7X6hrnWJwYG5APekTQ8hrB/8ILmgAHHzlkc4S 7mbuPld3b2TJN4gI0+jRiC9PoWLS7BePMQd1myjzREpsvK2BI/mWHhgGcSJHmlSwtU3D flN8yBZeNu46BiFKu6l6Up27lbN1+xg1ian+Q2123SwVvf2VaXWypfsj+NI93l0/2hl+ DVA41juUXr5SPlqCrb0CqkUwDyYd6YMXinm2fNkd++LGPUSYtCKTpHHF1FOLX6Nx4YNS GTUQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:message-id:date:subject:cc:to:from; bh=rbmcRMufsUlY33nKVJE8pDhxceTKwe+5akJ3dkWK1Mo=; b=JNV9xI+aigjRnF7JtovfvPeX0vVRycRaoxGp6LL8URiZNa2HgxZcKrSOXEC6EZM1CZ ak9mGOBdPyyLfFyF65UESVY1NWJKuizgrlujuEo+AU1u9uPOrRJyqI0heMFWswUgfs0y vJHPGpGQQCIAbFqs62F2ZE0sw8lqusXpcy6eAZe7zPDc8cSWQqsg6RhX1o3Bs7o1LXrD /KGmeZEUni8GET1GGs/dinewg+ewBHvUbHxCF21grmWnqUvRvJ4U7v2l1JWDFa287cVj Aw7jo81Oi39sb9RsMcSW7zlnyYzWYkmBh/E1BMq+wbhknKo4ibDgydEOllZdBY57aJUA XW3Q== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=virtuozzo.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id y12si11290535plk.174.2018.12.25.07.44.29; Tue, 25 Dec 2018 07:45:11 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=virtuozzo.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1725863AbeLYPje (ORCPT + 99 others); Tue, 25 Dec 2018 10:39:34 -0500 Received: from relay.sw.ru ([185.231.240.75]:52714 "EHLO relay.sw.ru" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725816AbeLYPje (ORCPT ); Tue, 25 Dec 2018 10:39:34 -0500 Received: from [10.94.4.83] (helo=finist-ce7.sw.ru) by relay.sw.ru with esmtp (Exim 4.91) (envelope-from ) id 1gbono-0006n5-5W; Tue, 25 Dec 2018 18:39:28 +0300 From: Konstantin Khorenko To: Andrew Morton Cc: Konstantin Khorenko , Andrey Ryabinin , linux-kernel@vger.kernel.org, linux-mm@kvack.org, Luis Chamberlain , Kees Cook , Michal Hocko Subject: [RFC PATCH 0/1] mm: add a warning about high order allocations Date: Tue, 25 Dec 2018 18:39:26 +0300 Message-Id: <20181225153927.2873-1-khorenko@virtuozzo.com> X-Mailer: git-send-email 2.15.1 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Q: Why do we need to bother at all? A: If a node is highly loaded and its memory is significantly fragmented (unfortunately almost any node with serious load has highly fragmented memory) then any high order memory allocation can trigger massive memory shrink and result in quite a big allocation latency. And the node becomes less responsive and users don't like it. The ultimate solution here is to get rid of large allocations, but we need an instrument to detect them. Q: Why warning? Use tracepoints! A: Well, this is a matter of magic defaults. Yes, you can use tracepoints to catch large allocations, but you need to do this on purpose and regularly and this is to be done by every developer which is quite unreal. On the other hand if you develop something and get a warning, you'll have to think about the reason and either succeed with reworking the code to use smaller allocation sizes (and thus decrease allocation latency!) or just use kvmalloc() if you don't really need physically continuos chunk or come to the conclusion you definitely need physically continuos memory and shut up the warning. Q: Why compile time config option? A: In order not to decrease the performance even a bit in case someone does not want to hunt for large allocations. In an ideal life i'd prefer this check/warning is enabled by default and may be even without a config option so it works on every node. Once we find and rework or mark all large allocations that would be good by default. Until that though it will be noisy. Another option is to rework the patch via static keys (having the warning disabled by default surely). That makes it possible to turn on the feature without recompiling the kernel - during testing period for example. If you prefer this way, i would be happy to rework the patch via static keys. Konstantin Khorenko (1): mm/page_alloc: add warning about high order allocations kernel/sysctl.c | 15 +++++++++++++++ mm/Kconfig | 18 ++++++++++++++++++ mm/page_alloc.c | 25 +++++++++++++++++++++++++ 3 files changed, 58 insertions(+) -- 2.15.1