From owner-freebsd-current@FreeBSD.ORG Mon Jun 29 01:05:11 2009 Return-Path: Delivered-To: freebsd-current@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id ECBD310656A6 for ; Mon, 29 Jun 2009 01:05:11 +0000 (UTC) (envelope-from alan.l.cox@gmail.com) Received: from mail-yx0-f181.google.com (mail-yx0-f181.google.com [209.85.210.181]) by mx1.freebsd.org (Postfix) with ESMTP id A5D528FC08 for ; Mon, 29 Jun 2009 01:05:11 +0000 (UTC) (envelope-from alan.l.cox@gmail.com) Received: by yxe11 with SMTP id 11so3318054yxe.3 for ; Sun, 28 Jun 2009 18:05:10 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:mime-version:received:reply-to:in-reply-to :references:date:message-id:subject:from:to:cc:content-type; bh=ZSx7nuKOFgWMGrjb+Hj6BznGwxhiyr1KyNG4fRrVxsU=; b=kU4P4vYXlhcMUtNJB160gscuMiFmXh9Th8kr5gAl1PjgX7G2pAw44clcUWaAplRAHB XHgSTJlgJ58TTvpczwk/GApecBNC/Sm1M/HfnR+TV4V+kxukkW9zbzUkjBxlEwvuxdPM 1lAVP2H5qytKyh0459n0v9anAZ/BxpFCERtbA= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=mime-version:reply-to:in-reply-to:references:date:message-id :subject:from:to:cc:content-type; b=OaXwzENJEWG/QuJtwSMDWjx511rqmCFUIS01VG/SXpaQtPE7HnSAMCzbjkW0nasBHX rCBWoKtgCX7Ebs1tKsAJXAgusmRPEU500kCrJQXi4YzWzFIUFYn6vDZdZoNKN7vHL17M SQRPVmoPj7t1JaCZ/19Lo1O37cXakoL16oF6c= MIME-Version: 1.0 Received: by 10.151.47.16 with SMTP id z16mr774984ybj.4.1246235858076; Sun, 28 Jun 2009 17:37:38 -0700 (PDT) In-Reply-To: <45d874490906281642r470089e2sc5b770f239f428e2@mail.gmail.com> References: <45d874490906281642r470089e2sc5b770f239f428e2@mail.gmail.com> Date: Sun, 28 Jun 2009 19:37:38 -0500 Message-ID: From: Alan Cox To: "Sean P. Dew" Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit X-Content-Filtered-By: Mailman/MimeDel 2.1.5 Cc: freebsd-current@freebsd.org Subject: Re: segment alignment in AMD64 X-BeenThere: freebsd-current@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list Reply-To: alc@freebsd.org List-Id: Discussions about the use of FreeBSD-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 29 Jun 2009 01:05:12 -0000 On Sun, Jun 28, 2009 at 6:42 PM, Sean P. Dew wrote: > Hi, > > Why is a loadable segment aligned to 1 MB on AMD64 while the pagezie is > still 4K for a user application. Is there anyway to change it back to 4K, > It > is not making sense to me is because if my file segment is around 400K, we > are wasting 1 MB of virtual address space ( granted it is not a lot for > X64). I am trying to find out the reason. I am posting the readelf output > of a .so. Any help is appreciated. > You'll find this question discussed in the mailing list archives on more than one occasion. Here is one such message: http://lists.freebsd.org/pipermail/freebsd-amd64/2007-September/010260.html To be a little more explicit, it is done to increase the likelihood that the entire code segment of a large program can be mapped using 2 MB page mappings. Moreover, to be able to do so without wasting any physical memory on padding. Although we have the necessary 2 MB page support in the virtual memory system, the kernel's image activator hasn't been modified to take advantage of this. Only a few programs with large code and data segments, e.g., emacs, will benefit. Regards, Alan