Received: by 2002:a05:6a10:22f:0:0:0:0 with SMTP id 15csp1093736pxk; Thu, 3 Sep 2020 23:35:56 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyK+Q09TPxiy4QS7ST/Dwoec75rM/dMiMcxkXlywAROJmJ1255rpXzMvOxNRfl6fT2iPHg9 X-Received: by 2002:aa7:cf0e:: with SMTP id a14mr7053172edy.81.1599201356692; Thu, 03 Sep 2020 23:35:56 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1599201356; cv=none; d=google.com; s=arc-20160816; b=JIduw0ujxVbSZzM4snsShQQoFRvYn3hggTztMSix8Nm8j8fSi2134ktcM1SDFFVTYX BG8w2bvchQ2KpobgINUF4fLwFXOZjOTt5mdcagVopI2OiJ031FNYcPKqNMekUCIYgCMY u04adrt4ooOFD5/m667mp5YZdqdoGgBENgn7RNgtHSr4l1NmtoxSTXZ8FHoVzDy5NzTF gMpb5nzoLHVpMDUkzkGHmcO3YFsqWc8tdNiK7H9PvoOGhkDjLRxF1bLZ9aF3+tBEICSG nmryLqPSRrMK1yt+TY59VynjWDc4qkXGkvFmCegbYJWC6UNGrUydlTut/V8/UIKfnQV5 vgvQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding :content-language:in-reply-to:mime-version:user-agent:date :message-id:autocrypt:from:references:cc:to:subject; bh=uyi7lPFeXaTAO0RuQc5MkqFeC0JXHK23MB0pTixZLQM=; b=UEQ96YazL/nIOOPbpo9RK5Q1QVBUbsZ36agQQnTF8q0IybNR4pmIzGexySQMVUURpz c9jfcTkPB9AKCrDuuMBZKUywcS8n8fyPWVWn8LQ+CYcIIexxDU3aSuR16yKMJn8EzWJu CldfKCl4F6iR3rrFTgx01PLLZNEBcdGv/4gw2wNqOQbGyQKicuL8orMmHhv5U62bNRC2 /wux8U0EdIdkCuF0VPcZI2bo6srQxGCrVOBo+mpXo7tzs/TQgRFGsydpr+fxNE0yfjFc p2qBDRukCtuXmDwXcCwa32kc/XqusO+RYxBGj0BUW+pBTi0vD+UKRYvV/KcQ+A9QQfBX zOOg== ARC-Authentication-Results: i=1; mx.google.com; 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 Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id w12si3512097ejy.64.2020.09.03.23.35.33; Thu, 03 Sep 2020 23:35:56 -0700 (PDT) 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; 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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726425AbgIDGdC (ORCPT + 99 others); Fri, 4 Sep 2020 02:33:02 -0400 Received: from mx2.suse.de ([195.135.220.15]:55850 "EHLO mx2.suse.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726151AbgIDGc7 (ORCPT ); Fri, 4 Sep 2020 02:32:59 -0400 X-Virus-Scanned: by amavisd-new at test-mx.suse.de Received: from relay2.suse.de (unknown [195.135.221.27]) by mx2.suse.de (Postfix) with ESMTP id 05A0DB5D8; Fri, 4 Sep 2020 06:32:58 +0000 (UTC) Subject: Re: [PATCH] mm/memory_hotplug: drain per-cpu pages again during memory offline To: Pavel Tatashin , David Hildenbrand Cc: Michal Hocko , LKML , Andrew Morton , linux-mm References: <20200901124615.137200-1-pasha.tatashin@soleen.com> <20200902140851.GJ4617@dhcp22.suse.cz> <74f2341a-7834-3e37-0346-7fbc48d74df3@suse.cz> <20200902151306.GL4617@dhcp22.suse.cz> <20200903063806.GM4617@dhcp22.suse.cz> From: Vlastimil Babka Autocrypt: addr=vbabka@suse.cz; prefer-encrypt=mutual; ke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Thunderbird/68.11.0 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 9/3/20 8:23 PM, Pavel Tatashin wrote: >> >> As expressed in reply to v2, I dislike this hack. There is strong >> synchronization, just PCP is special. Allocating from MIGRATE_ISOLATE is >> just plain ugly. >> >> Can't we temporarily disable PCP (while some pageblock in the zone is >> isolated, which we know e.g., due to the counter), so no new pages get >> put into PCP lists after draining, and re-enable after no pageblocks are >> isolated again? We keep draining the PCP, so it doesn't seem to be of a >> lot of use during that period, no? It's a performance hit already. >> >> Then, we would only need exactly one drain. And we would only have to >> check on the free path whether PCP is temporarily disabled. > > Hm, we could use a static branches to disable it, that would keep > release code just as fast, but I am worried it will make code even > uglier. Let's see what others in this thread think about this idea. Maybe we could just set pcp->high = 0 or something, make sure the pcplist user only reads this value while irqs are disabled. Then the the IPI in drain_all_pages() should guarantee there's nobody racing freeing to pcplist. But careful to not introduce bugs like the one fixed with [1]. And not sure if this guarantee survives when RT comes and replaces the disabled irq's with local_lock or something. [1] https://lore.kernel.org/linux-mm/1597150703-19003-1-git-send-email-charante@codeaurora.org/ > Thank you, > Pasha >