Received: by 2002:a05:6a10:f347:0:0:0:0 with SMTP id d7csp1161832pxu; Fri, 27 Nov 2020 00:52:59 -0800 (PST) X-Google-Smtp-Source: ABdhPJxjK/VYVG61OfXc5qFdyj17HjxQvWWqyjg0267aan6w1kjDw8H6Yn5gaKlBYenA8u3H25uO X-Received: by 2002:a17:906:b745:: with SMTP id fx5mr6400048ejb.103.1606467179365; Fri, 27 Nov 2020 00:52:59 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1606467179; cv=none; d=google.com; s=arc-20160816; b=NCVbw/W50+VcLbiE1ULkUmuNmz61v5jkmcgc+k9qJaTXTX/Vrnw8G7yy38vH0WTXK5 eF19nbr45VsKlem5UQcMrwtORj0QHlut41Rq0nC6Bb9MKyxCXU5xY2euSOdVh9CI0LlP JCUBRt8ANThHRFA6Fn3mZWElAelnkHk22+QQeotYqPL+bCHCkWY1L9B/a5vV/cAGPMch DsEAkXjqd0U7O4U02yq+aU50NZ4Lsc9dAm3juNHzwh7P55XGBRwdbC5M1ULNGnGBHJHr ZdF0F8KgIs94T9mNZUNVOdO22Nc+nkHk6wm2d6YGM/qp6JENmHA1Rh1KlQ4UV1X8WEmv XnIA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-disposition:mime-version :references:message-id:subject:cc:to:from:date:dkim-signature; bh=Dv338FZywGqGP/dCr519csJ4GRHLbufPxoxUCPl8E0E=; b=pW77EBAK3+4Zm0PI5h5C/Bt8mrfjRSSMi3doj1yueJCoJ0RkV7y9DhJ6xJFOxmu9U/ tPHpiWkIkon7VNsgv7WrkT7AP30qUjE9+ZnJCR1HY7mDtiI8BOExKD8rL7bSmFqQDmCr ZjlDF19sZfYbNJ9uJEcs3OaFVMzbGEbNCcMAHMJ0rY1U4fm+a/OUG8Sdl17PheBTeKc/ 85indJUjlGyZR6YKoqWdFZmtTjiAYCbUztCFD3zAQBcOvli3u0sl4UbSiwBpvS4BWZYm rvbLUXn6+Ybaai7wFAcOJ3/9+HgT2w6NeNWEPfsFWRUmI0rPTlUkNDmbPmb/2JYgh2qA +mzA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@suse.com header.s=susede1 header.b=m276pUsu; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=QUARANTINE sp=NONE dis=NONE) header.from=suse.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id de23si601370edb.528.2020.11.27.00.52.37; Fri, 27 Nov 2020 00:52:59 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@suse.com header.s=susede1 header.b=m276pUsu; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=QUARANTINE sp=NONE dis=NONE) header.from=suse.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2405359AbgK0HwR (ORCPT + 99 others); Fri, 27 Nov 2020 02:52:17 -0500 Received: from mx2.suse.de ([195.135.220.15]:55658 "EHLO mx2.suse.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2392782AbgK0HwR (ORCPT ); Fri, 27 Nov 2020 02:52:17 -0500 X-Virus-Scanned: by amavisd-new at test-mx.suse.de DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.com; s=susede1; t=1606463535; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=Dv338FZywGqGP/dCr519csJ4GRHLbufPxoxUCPl8E0E=; b=m276pUsuAkFOuJ+rOcffnleR3l126vOOLZcm8JOk1O9J6DGquPKwgvru4d66ATO1lvnTKE Z8Rqvmp+s/krb+Hm07ZcyIB1Fsj+qQeJPdxNbe0AwGac6mQYtbbRXDH1bunjQur6mLAdFY WxzDjwvP/UMy6P+ZdWlTtJE+bhBNxzo= Received: from relay2.suse.de (unknown [195.135.221.27]) by mx2.suse.de (Postfix) with ESMTP id 632D5AC2F; Fri, 27 Nov 2020 07:52:15 +0000 (UTC) Date: Fri, 27 Nov 2020 08:52:14 +0100 From: Michal Hocko To: Rik van Riel Cc: hughd@google.com, xuyu@linux.alibaba.com, akpm@linux-foundation.org, mgorman@suse.de, aarcange@redhat.com, willy@infradead.org, linux-kernel@vger.kernel.org, kernel-team@fb.com, linux-mm@kvack.org, vbabka@suse.cz Subject: Re: [PATCH 2/3] mm,thp,shm: limit gfp mask to no more than specified Message-ID: <20201127075214.GK31550@dhcp22.suse.cz> References: <20201124194925.623931-1-riel@surriel.com> <20201124194925.623931-3-riel@surriel.com> <20201126134034.GI31550@dhcp22.suse.cz> <920c627330f3c7d295ab58edd1b62f28fdbd14bc.camel@surriel.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <920c627330f3c7d295ab58edd1b62f28fdbd14bc.camel@surriel.com> Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Thu 26-11-20 13:04:14, Rik van Riel wrote: > On Thu, 2020-11-26 at 14:40 +0100, Michal Hocko wrote: > > On Tue 24-11-20 14:49:24, Rik van Riel wrote: > > > Matthew Wilcox pointed out that the i915 driver opportunistically > > > allocates tmpfs memory, but will happily reclaim some of its > > > pool if no memory is available. > > > > > > Make sure the gfp mask used to opportunistically allocate a THP > > > is always at least as restrictive as the original gfp mask. > > > > I have brought this up in the previous version review and I feel my > > feedback hasn't been addressed. Please describe the expected behavior > > by > > those shmem users including GFP_KERNEL restriction which would make > > the > > THP flags incompatible. Is this a problem? Is there any actual > > problem > > if the THP uses its own set of flags? > > In the case of i915, the gfp flags passed in by the i915 > driver expect the VM to easily fail the allocation, in > which case the i915 driver will reclaim some existing > buffers and try again. The existing code tries hard to prevent from the oom killer AFAIU. At least that is what i915_gem_object_get_pages_gtt says. And that is ok for order-0 (or low order) requests. But THPs are costly orders and therefore __GFP_NORETRY has a different meaning. It still controls how hard to try compact but this is not a OOM control. ttm_tt_swapout is similar except it chosen to try harder for order-0 cases but still want to prevent the oom killer. > Trying harder than the original gfp_mask would change the OOM behavior > of systems using the i915 driver. > > > I am also not happy how those two sets of flags are completely > > detached > > and we can only expect surprises there. > > I would be more than happy to implement things differently, > but I am not sure what alternative you are suggesting. Simply do not alter gfp flags? Or warn in some cases of a serious mismatch. E.g. GFP_ZONEMASK mismatch because there are already GFP_KERNEL users of shmem. -- Michal Hocko SUSE Labs