Received: by 2002:a05:6a10:f347:0:0:0:0 with SMTP id d7csp2624982pxu; Mon, 14 Dec 2020 07:09:22 -0800 (PST) X-Google-Smtp-Source: ABdhPJw8JnWKFHpH45ugT60lSAdWo0msG2H2IkfrbOuA16CaKSZF8X/KBk0/jxp69NrUwSRb1mgg X-Received: by 2002:a17:906:24c3:: with SMTP id f3mr22436021ejb.238.1607958561718; Mon, 14 Dec 2020 07:09:21 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1607958561; cv=none; d=google.com; s=arc-20160816; b=oEz58sp2q4Wge7W5ryIAidEZqK/qNcq7jfvAygv6IGCa6Ns+v8MZy8KKQWkqFY1YsP 1F924/gOzVISHfg2Bjazo4aTfwzWyNKUwQn5Aj4MIXaVh9b9pvcPd+roYMPHoYyRzDBF P17P0Czf1KEDyGOIq4I/k/RrwLtvmfbRYt0yuA2J5tleTo1bjb36BoH64C+TTAdbltht g2VyVpSiJKvPuJpJw4wDRAWt4QmU485iLBYk2HJvgfW9Dq5N7Le040LtpFsb6P1/YR6G 598ShnLuZVJ5cP6gseheN8xpuLHtNDCa3I7vhKJF5VQYR3oU59bOfxowAPOzcEDwfVBz GmRQ== 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=HQdxKLHG4KjlshDHSNjNPPhYXulApwPDLbssolkNoJc=; b=BGwodZAPSKF16ild9Z/8bV7pQVXDvkRDgdtIiAFH+DibAl7+nVQF47jD1lSO7ldpxG 9uws61F7AGXtBfwnf9Aqx2v0Cn363kfUBJKpyJXIqTJy+Xoj6BsevXSjXXWEvB1LKzzI MpPElisAAVbX5F75jGoJbAMUBoeYa5hu5ojcLRuEDq3921sl/TJE3oBMEonwrA9XKyQo CafMKoIoAEHUEkpZ+WRDTrsqzARiB3isJ+XrMB1IUKbrJvocXwjy6rkorRPKt0npVh4n ks6hxRZdShfwvhY4GdCz4TPS7nmJeSg7dQr0l0AOO40yUl5Pbp2lef+lyBeWOwGx8Ljn npaA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@suse.com header.s=susede1 header.b=L9W6oCEn; 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 h26si10047803ejq.399.2020.12.14.07.08.55; Mon, 14 Dec 2020 07:09:21 -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=L9W6oCEn; 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 S2408076AbgLNOEZ (ORCPT + 99 others); Mon, 14 Dec 2020 09:04:25 -0500 Received: from mx2.suse.de ([195.135.220.15]:56586 "EHLO mx2.suse.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1731840AbgLNOEZ (ORCPT ); Mon, 14 Dec 2020 09:04:25 -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=1607954619; 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=HQdxKLHG4KjlshDHSNjNPPhYXulApwPDLbssolkNoJc=; b=L9W6oCEnlei941fAO1yaDiBi6ShMzHnjLWPYxRNiO8oW6mgu9B+R/YTld8mjdQ8fkNR9id 4lA2Ww+eln8GMpgkgtQnTSspzwujFVpahvAxsfhxjSDa+hoARP92giv+dgs+h1Bd9LAQKj Bd9eQerASJ3qrOz4Veqr3i70vvChixc= Received: from relay2.suse.de (unknown [195.135.221.27]) by mx2.suse.de (Postfix) with ESMTP id DF3A1AEA2; Mon, 14 Dec 2020 14:03:38 +0000 (UTC) Date: Mon, 14 Dec 2020 15:03:37 +0100 From: Michal Hocko To: Pavel Tatashin Cc: linux-kernel@vger.kernel.org, linux-mm@kvack.org, akpm@linux-foundation.org, vbabka@suse.cz, david@redhat.com, osalvador@suse.de, dan.j.williams@intel.com, sashal@kernel.org, tyhicks@linux.microsoft.com, iamjoonsoo.kim@lge.com, mike.kravetz@oracle.com, rostedt@goodmis.org, mingo@redhat.com, jgg@ziepe.ca, peterz@infradead.org, mgorman@suse.de, willy@infradead.org, rientjes@google.com, jhubbard@nvidia.com, linux-doc@vger.kernel.org Subject: Re: [PATCH v3 2/6] mm cma: rename PF_MEMALLOC_NOCMA to PF_MEMALLOC_PIN Message-ID: <20201214140337.GD32193@dhcp22.suse.cz> References: <20201211202140.396852-1-pasha.tatashin@soleen.com> <20201211202140.396852-3-pasha.tatashin@soleen.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20201211202140.396852-3-pasha.tatashin@soleen.com> Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Fri 11-12-20 15:21:36, Pavel Tatashin wrote: > PF_MEMALLOC_NOCMA is used ot guarantee that the allocator will not return > pages that might belong to CMA region. This is currently used for long > term gup to make sure that such pins are not going to be done on any CMA > pages. > > When PF_MEMALLOC_NOCMA has been introduced we haven't realized that it is > focusing on CMA pages too much and that there is larger class of pages that > need the same treatment. MOVABLE zone cannot contain any long term pins as > well so it makes sense to reuse and redefine this flag for that usecase as > well. Rename the flag to PF_MEMALLOC_PIN which defines an allocation > context which can only get pages suitable for long-term pins. > > Also re-name: > memalloc_nocma_save()/memalloc_nocma_restore > to > memalloc_pin_save()/memalloc_pin_restore() > and make the new functions common. > > Signed-off-by: Pavel Tatashin > Reviewed-by: John Hubbard Acked-by: Michal Hocko with one comment below [...] > --- a/include/linux/sched.h > +++ b/include/linux/sched.h > @@ -1576,7 +1576,7 @@ extern struct pid *cad_pid; > #define PF_SWAPWRITE 0x00800000 /* Allowed to write to swap */ > #define PF_NO_SETAFFINITY 0x04000000 /* Userland is not allowed to meddle with cpus_mask */ > #define PF_MCE_EARLY 0x08000000 /* Early kill for mce process policy */ > -#define PF_MEMALLOC_NOCMA 0x10000000 /* All allocation request will have _GFP_MOVABLE cleared */ > +#define PF_MEMALLOC_PIN 0x10000000 /* All allocation request will have _GFP_MOVABLE cleared */ This comment is not really helpeful. I would go with /* Allocation context constrained to zones which allow long term * pinning. */ Something similar would be useful for memalloc_pin* functions as well. -- Michal Hocko SUSE Labs